Sha256: d204723a7c0f0077e0b3d7f3a83fe29a6a8d21f590f54f5539286ef35266f007
Contents?: true
Size: 376 Bytes
Versions: 12
Compression:
Stored size: 376 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 unless method_defined?(:deep_merge) end
Version data entries
12 entries across 12 versions & 1 rubygems