Class: Shackles::ConnectionSpecification::CacheCoherentHash
- Inherits:
-
Hash
- Object
- Hash
- Shackles::ConnectionSpecification::CacheCoherentHash
- Defined in:
- lib/shackles/connection_specification.rb
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
- #delete(key) ⇒ Object
- #dup ⇒ Object
-
#initialize(spec) ⇒ CacheCoherentHash
constructor
A new instance of CacheCoherentHash.
-
#transform_keys(&block) ⇒ Object
in rails 4.2, active support tries to create a copy of the original object’s class instead of making a new Hash object, so it fails since initialize expects an argument.
Constructor Details
#initialize(spec) ⇒ CacheCoherentHash
Returns a new instance of CacheCoherentHash.
6 7 8 9 |
# File 'lib/shackles/connection_specification.rb', line 6 def initialize(spec) @spec = spec super end |
Instance Method Details
#[]=(key, value) ⇒ Object
11 12 13 14 15 |
# File 'lib/shackles/connection_specification.rb', line 11 def []=(key, value) super @spec.instance_variable_set(:@current_config, nil) @spec.instance_variable_get(:@config)[key] = value end |
#delete(key) ⇒ Object
17 18 19 20 21 |
# File 'lib/shackles/connection_specification.rb', line 17 def delete(key) super @spec.instance_variable_set(:@current_config, nil) @spec.instance_variable_get(:@config).delete(key) end |
#dup ⇒ Object
23 24 25 |
# File 'lib/shackles/connection_specification.rb', line 23 def dup Hash[self] end |
#transform_keys(&block) ⇒ Object
in rails 4.2, active support tries to create a copy of the original object’s class instead of making a new Hash object, so it fails since initialize expects an argument
29 30 31 |
# File 'lib/shackles/connection_specification.rb', line 29 def transform_keys(&block) dup.transform_keys(&block) end |