Class: CanTango::Configuration::HashRegistry
- Defined in:
- lib/cantango/configuration/hash_registry.rb
Direct Known Subclasses
Instance Method Summary collapse
- #<<(hash) ⇒ Object
- #[](label) ⇒ Object
- #[]=(label, value) ⇒ Object
- #clean! ⇒ Object
- #clear! ⇒ Object
- #default ⇒ Object
- #default! ⇒ Object
- #default=(hash) ⇒ Object
- #register(hash) ⇒ Object
- #registered ⇒ Object
- #types ⇒ Object
- #types=(*types) ⇒ Object
Methods inherited from Registry
Instance Method Details
#<<(hash) ⇒ Object
28 29 30 31 |
# File 'lib/cantango/configuration/hash_registry.rb', line 28 def << hash raise "Must be a hash" if !hash.is_a? Hash registered.merge! hash end |
#[](label) ⇒ Object
33 34 35 36 |
# File 'lib/cantango/configuration/hash_registry.rb', line 33 def [] label raise "Must be a label" if !label.kind_of_label? registered[label.to_s] end |
#[]=(label, value) ⇒ Object
38 39 40 41 |
# File 'lib/cantango/configuration/hash_registry.rb', line 38 def []= label, value raise "Must be a label" if !label.kind_of_label? registered[label.to_s] = value end |
#clean! ⇒ Object
16 17 18 |
# File 'lib/cantango/configuration/hash_registry.rb', line 16 def clean! registered = Hashie::Mash.new end |
#clear! ⇒ Object
20 21 22 |
# File 'lib/cantango/configuration/hash_registry.rb', line 20 def clear! clean! end |
#default ⇒ Object
52 53 54 |
# File 'lib/cantango/configuration/hash_registry.rb', line 52 def default @default ||= Hashie::Mash.new end |
#default! ⇒ Object
24 25 26 |
# File 'lib/cantango/configuration/hash_registry.rb', line 24 def default! @registered = default end |
#default=(hash) ⇒ Object
56 57 58 |
# File 'lib/cantango/configuration/hash_registry.rb', line 56 def default= hash @default = Hashie::Mash.new hash end |
#register(hash) ⇒ Object
43 44 45 46 |
# File 'lib/cantango/configuration/hash_registry.rb', line 43 def register hash raise "Must be a hash" if !hash.is_a? Hash registered.merge! hash end |
#registered ⇒ Object
48 49 50 |
# File 'lib/cantango/configuration/hash_registry.rb', line 48 def registered @registered ||= default end |
#types ⇒ Object
12 13 14 |
# File 'lib/cantango/configuration/hash_registry.rb', line 12 def types [Hash] end |
#types=(*types) ⇒ Object
8 9 10 |
# File 'lib/cantango/configuration/hash_registry.rb', line 8 def types= *types raise "This is a Hash registry!" end |