class

RNS::ConfigObj

Inherits Reference < Object

A configuration file parser compatible with Python's configobj. Supports nested sections via bracket depth ([section], [[subsection]], etc.), key = value pairs, comments, list values, boolean/int/float coercion, and file I/O.

Constants

BOOLS = {"yes" => true, "no" => false, "on" => true, "off" => false, "1" => true, "0" => false, "true" => true, "false" => false}

Boolean map matching Python configobj._bools

KEYWORD_RE = /^\s*((?:".*?")|(?:'.*?')|(?:[^'"=].*?))\s*=\s*(.*)$/

Key = value regex

SECTION_RE = /^\s*((?:\[\s*)+)((?:".*?")|(?:'.*?')|(?:[^'"\s].*?))((?:\s*\])+)\s*(?:#.*)?$/

Section marker regex: matches [section], [[section]], etc.

Constructors

from_file(path : String) : ConfigObj
Source
new(lines : Array(String))
Source

Instance methods

[](*args, **options)
Source
[](*args, **options, &)
Source
[]=(*args, **options)
Source
[]=(*args, **options, &)
Source
add_section(*args, **options)
Source
add_section(*args, **options, &)
Source
as_bool(*args, **options)
Source
as_bool(*args, **options, &)
Source
as_float(*args, **options)
Source
as_float(*args, **options, &)
Source
as_int(*args, **options)
Source
as_int(*args, **options, &)
Source
as_list(*args, **options)
Source
as_list(*args, **options, &)
Source
depth(*args, **options)
Source
depth(*args, **options, &)
Source
filename
Source
filename=(filename : String | Nil)
Source
get(*args, **options)
Source
get(*args, **options, &)
Source
has_key?(*args, **options)
Source
has_key?(*args, **options, &)
Source
root

Root-level fields

Source
scalars(*args, **options)
Source
scalars(*args, **options, &)
Source
section(*args, **options)
Source
section(*args, **options, &)
Source
sections(*args, **options)
Source
sections(*args, **options, &)
Source
size(*args, **options)
Source
size(*args, **options, &)
Source
write(path : String | Nil = nil)
Source

Nested types