Class: Wardrobe::Plugins::Configurable::ConfigurableStore
- Defined in:
- lib/wardrobe/plugins/configurable/configurable_store.rb
Instance Attribute Summary
Attributes inherited from Store
Instance Method Summary collapse
Methods inherited from Store
#[], #del, #each, #freeze, #initialize, #merge, #method_missing, #values
Constructor Details
This class inherits a constructor from Wardrobe::Store
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Wardrobe::Store
Instance Method Details
#register(name, klass) ⇒ Object
8 9 10 11 12 |
# File 'lib/wardrobe/plugins/configurable/configurable_store.rb', line 8 def register(name, klass) mutate do store.merge!(name => klass.new.freeze) end end |
#update(name, &blk) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/wardrobe/plugins/configurable/configurable_store.rb', line 14 def update(name, &blk) if frozen? dup.update(name, &blk) else duplicate = @store[name].mutate(&blk) @store = @store.merge(name => duplicate) freeze end end |