Class: Darthjee::CoreExt::Hash::DeepHashConstructor::Setter Private
- Defined in:
- lib/darthjee/core_ext/hash/deep_hash_constructor/setter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class responsible for setting value localized inside hash
Instance Method Summary collapse
-
#initialize(hash, base_key) ⇒ Setter
constructor
private
A new instance of Setter.
-
#set(key, value) ⇒ ::Object
private
Sets a value in the correct key inside the hash.
Constructor Details
#initialize(hash, base_key) ⇒ Setter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Setter.
29 30 31 32 |
# File 'lib/darthjee/core_ext/hash/deep_hash_constructor/setter.rb', line 29 def initialize(hash, base_key) @hash = hash @base_key = base_key end |
Instance Method Details
#set(key, value) ⇒ ::Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets a value in the correct key inside the hash
57 58 59 60 61 62 |
# File 'lib/darthjee/core_ext/hash/deep_hash_constructor/setter.rb', line 57 def set(key, value) return hash[base_key] = value unless key || index return array[index] = value unless key sub_hash[key] = value end |