Class: Darthjee::CoreExt::Hash::DeepHashConstructor Private
- Defined in:
- lib/darthjee/core_ext/hash/deep_hash_constructor.rb,
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 creating a Hash deep hash
Deep hash construction happens when a hash of one layer (no sub hashes) has keys that, once explitted, can be assembled in a hash with many layers
Defined Under Namespace
Classes: Setter
Instance Method Summary collapse
-
#deep_hash(hash) ⇒ ::Hash
private
Performs deep hash transformation.
-
#initialize(separator = '.') ⇒ DeepHashConstructor
constructor
private
A new instance of DeepHashConstructor.
Constructor Details
#initialize(separator = '.') ⇒ DeepHashConstructor
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 DeepHashConstructor.
49 50 51 |
# File 'lib/darthjee/core_ext/hash/deep_hash_constructor.rb', line 49 def initialize(separator = '.') @separator = separator end |
Instance Method Details
#deep_hash(hash) ⇒ ::Hash
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.
Performs deep hash transformation
60 61 62 63 64 65 66 |
# File 'lib/darthjee/core_ext/hash/deep_hash_constructor.rb', line 60 def deep_hash(hash) break_keys(hash).tap do hash.each do |key, value| hash[key] = deep_hash_value(value) end end end |