Class: Fini::IniObject
- Inherits:
-
Object
- Object
- Fini::IniObject
- Defined in:
- lib/fini.rb
Overview
An object that holds the data from the parsed ini-file. Sections are accessed as methods, which returns a hash.
Instance Method Summary collapse
- #get_section(key) ⇒ Hash
-
#initialize ⇒ IniObject
constructor
A new instance of IniObject.
Constructor Details
#initialize ⇒ IniObject
Returns a new instance of IniObject.
79 80 81 |
# File 'lib/fini.rb', line 79 def initialize @data = {} end |
Instance Method Details
#get_section(key) ⇒ Hash
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/fini.rb', line 85 def get_section key if key.include? '.' sections = key.split('.') obj = do_get_section sections.shift sections.each do |key| key = key.to_sym if obj.has_key? key obj = obj[key] else obj = obj[key] = {} end end obj else do_get_section key end end |