Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/codnar/hash_extensions.rb

Overview

Extend the core Hash class.

Instance Method Summary collapse

Instance Method Details

#deep_cloneObject

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