Sha256: cf29fca939640008441cb219d2cd260af182d4310c017d25bd25c1d42f23f23b
Contents?: true
Size: 338 Bytes
Versions: 9
Compression:
Stored size: 338 Bytes
Contents
class Hash def deep_merge(other_hash) self.merge(other_hash) do |key, oldval, newval| oldval = oldval.to_hash if oldval.respond_to?(:to_hash) newval = newval.to_hash if newval.respond_to?(:to_hash) oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? oldval.deep_merge(newval) : newval end end end
Version data entries
9 entries across 9 versions & 1 rubygems