Sha256: 689c7ff489d9d63ba291b78433e9022ff5aa5b40c5bfaf60a989fcc81d4bf610
Contents?: true
Size: 440 Bytes
Versions: 206
Compression:
Stored size: 440 Bytes
Contents
class Hash # Returns a new hash with +self+ and +other_hash+ merged recursively. def deep_merge(other_hash) dup.deep_merge!(other_hash) end # Returns a new hash with +self+ and +other_hash+ merged recursively. # Modifies the receiver in place. 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 end self end end
Version data entries
206 entries across 193 versions & 10 rubygems