lib/procemon/mpatch/hash.rb in procemon-0.7.0 vs lib/procemon/mpatch/hash.rb in procemon-0.8.0
- old
+ new
@@ -57,9 +57,11 @@
# h2.deep_merge(h1) #=> { :x => {:y => [4, 5, 6]}, :z => [7, 8, 9] }
def deep_merge(other_hash)
dup.deep_merge!(other_hash)
end unless method_defined? :deep_merge
+ alias :+ :deep_merge
+
# Same as +deep_merge+, but modifies +self+.
def deep_merge!(other_hash)
other_hash.each_pair do |k,v|
tv = self[k]
self[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_merge(v) : v
\ No newline at end of file