Class: Configural::Config
- Inherits:
-
Object
- Object
- Configural::Config
- Defined in:
- lib/configural/config.rb
Defined Under Namespace
Classes: FileBase, JSONFile, PlistFile, SDLFile, YAMLFile
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#owner ⇒ Object
Returns the value of attribute owner.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
-
#initialize(owner) ⇒ Config
constructor
A new instance of Config.
- #path ⇒ Object
- #save_all ⇒ Object
Constructor Details
#initialize(owner) ⇒ Config
Returns a new instance of Config.
37 38 39 40 41 42 43 44 |
# File 'lib/configural/config.rb', line 37 def initialize( owner ) @owner = owner @files = {} @options = { :default_format => 'yaml', :lazy_loading => false, } end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
35 36 37 |
# File 'lib/configural/config.rb', line 35 def @options end |
#owner ⇒ Object
Returns the value of attribute owner.
35 36 37 |
# File 'lib/configural/config.rb', line 35 def owner @owner end |
Instance Method Details
#[](name) ⇒ Object
50 51 52 |
# File 'lib/configural/config.rb', line 50 def [](name) @files[name.to_s] ||= make_file(name.to_s) end |
#[]=(name, value) ⇒ Object
54 55 56 |
# File 'lib/configural/config.rb', line 54 def []=(name, value) @files[name.to_s] = value end |
#path ⇒ Object
46 47 48 |
# File 'lib/configural/config.rb', line 46 def path @owner.config_path end |
#save_all ⇒ Object
58 59 60 61 |
# File 'lib/configural/config.rb', line 58 def save_all @files.each_value{ |file| file.save } self end |