Class: Confuse::Source::Ini
- Inherits:
-
Object
- Object
- Confuse::Source::Ini
- Defined in:
- lib/confuse/source/ini.rb
Instance Method Summary collapse
- #[](namespace, key) ⇒ Object
- #from_file(file) ⇒ Object
-
#initialize(options = {}) ⇒ Ini
constructor
A new instance of Ini.
Constructor Details
#initialize(options = {}) ⇒ Ini
Returns a new instance of Ini.
8 9 10 |
# File 'lib/confuse/source/ini.rb', line 8 def initialize( = {}) @ini = from_file([:path]) end |
Instance Method Details
#[](namespace, key) ⇒ Object
18 19 20 21 |
# File 'lib/confuse/source/ini.rb', line 18 def [](namespace, key) namespace ||= :global @ini[namespace.to_s][key.to_s] end |
#from_file(file) ⇒ Object
12 13 14 15 16 |
# File 'lib/confuse/source/ini.rb', line 12 def from_file(file) IniFile.load(file).to_h rescue IniFile::Error nil end |