Module: DeepNest::Helpers
Instance Method Summary collapse
-
#deep_dup ⇒ Hash, Array
Returns a deep copy of the passed hash or array.
-
#deep_equal?(other_structure) ⇒ true, false
Returns true if the passed parameters are same in structure and values, false otherwise.
-
#deep_merge(other_hash) {|&block| ... } ⇒ Hash
Returns a hash with the passed hashes recursively merged.
-
#deep_stringify_keys ⇒ Hash, Array
Returns a hash or array with all hash keys converted to strings.
-
#deep_symbolize_keys ⇒ Hash, Array
Returns a hash or array with all hash keys converted to symbols.
-
#deep_transform_keys {|&block| ... } ⇒ Hash, Array
Returns a hash or array with all hash keys modified by the passed block.
-
#deep_transform_values {|&block| ... } ⇒ Hash, Array
Returns a hash or array with all hash values modified by the passed block.
Instance Method Details
#deep_dup ⇒ Hash, Array
Returns a deep copy of the passed hash or array.
19 20 21 |
# File 'lib/deep_nest/helpers.rb', line 19 def deep_dup DeepNest.deep_dup(self) end |
#deep_equal?(other_structure) ⇒ true, false
Returns true if the passed parameters are same in structure and values, false otherwise.
47 48 49 |
# File 'lib/deep_nest/helpers.rb', line 47 def deep_equal?(other_structure) DeepNest.deep_equal?(self, other_structure) end |
#deep_merge(other_hash) {|&block| ... } ⇒ Hash
Returns a hash with the passed hashes recursively merged. An optional block can be passed to merge values.
33 34 35 |
# File 'lib/deep_nest/helpers.rb', line 33 def deep_merge(other_hash, &block) DeepNest.deep_merge(self, other_hash, &block) end |
#deep_stringify_keys ⇒ Hash, Array
Returns a hash or array with all hash keys converted to strings.
81 82 83 |
# File 'lib/deep_nest/helpers.rb', line 81 def deep_stringify_keys DeepNest.deep_stringify_keys(self) end |
#deep_symbolize_keys ⇒ Hash, Array
Returns a hash or array with all hash keys converted to symbols.
91 92 93 |
# File 'lib/deep_nest/helpers.rb', line 91 def deep_symbolize_keys DeepNest.deep_symbolize_keys(self) end |
#deep_transform_keys {|&block| ... } ⇒ Hash, Array
Returns a hash or array with all hash keys modified by the passed block.
59 60 61 |
# File 'lib/deep_nest/helpers.rb', line 59 def deep_transform_keys(&block) DeepNest.deep_transform_keys(self, &block) end |
#deep_transform_values {|&block| ... } ⇒ Hash, Array
Returns a hash or array with all hash values modified by the passed block.
71 72 73 |
# File 'lib/deep_nest/helpers.rb', line 71 def deep_transform_values(&block) DeepNest.deep_transform_values(self, &block) end |