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

Version Path
airbrake-api-4.6.1 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.6.0 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.5.1 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.5.0 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.4.0 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.3.0 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.2.2 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.2.1 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.2.0 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.1.3 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.1.2 lib/airbrake-api/core_ext/hash.rb
airbrake-api-4.1.1 lib/airbrake-api/core_ext/hash.rb