Class: Cardigan::Configuration
- Inherits:
-
Object
- Object
- Cardigan::Configuration
- Defined in:
- lib/cardigan/configuration.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(directory, name) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(directory, name) ⇒ Configuration
Returns a new instance of Configuration.
3 4 5 6 7 |
# File 'lib/cardigan/configuration.rb', line 3 def initialize directory, name @directory = directory @name = name @config = @directory.exist?(name) ? @directory[name] : {} end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 |
# File 'lib/cardigan/configuration.rb', line 9 def [] key @config[key] end |
#[]=(key, value) ⇒ Object
13 14 15 16 17 |
# File 'lib/cardigan/configuration.rb', line 13 def []= key, value @config[key] = value @config.delete key unless value @directory[@name] = @config end |