Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/codnar/hash_extensions.rb
Overview
Extend the core Hash class.
Instance Method Summary collapse
-
#deep_clone ⇒ Object
Obtain a deep clone which shares nothing with this hash.
-
#deep_merge(hash) ⇒ Object
Perform a deep merge with another hash.
Instance Method Details
#deep_clone ⇒ Object
Obtain a deep clone which shares nothing with this hash.
5 6 7 |
# File 'lib/codnar/hash_extensions.rb', line 5 def deep_clone return YAML.load(to_yaml) end |
#deep_merge(hash) ⇒ Object
Perform a deep merge with another hash.
12 13 14 |
# File 'lib/codnar/hash_extensions.rb', line 12 def deep_merge(hash) return merge(hash, &Hash::method("deep_merger")) end |