Sha256: 271a385f4bb4e937b253441f1811fc65cc682c0a5964e5ef108658a0f1d0f782

Contents?: true

Size: 261 Bytes

Versions: 6

Compression:

Stored size: 261 Bytes

Contents

class Hash
  def deep_merge(other)
    dup.deep_merge!(other)
  end

  def deep_merge!(other)
    other.each_pair do |key, val|
      tval = self[key]
      self[key] = tval.is_a?(Hash) && val.is_a?(Hash) ? tval.deep_merge(val) : val
    end
    self
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
github_api-0.11.2 lib/github_api/core_ext/deep_merge.rb
github_api-0.11.1 lib/github_api/core_ext/deep_merge.rb
github_api-0.11.0 lib/github_api/core_ext/deep_merge.rb
github_api-0.10.2 lib/github_api/core_ext/deep_merge.rb
github_api-0.10.1 lib/github_api/core_ext/deep_merge.rb
github_api-0.10.0 lib/github_api/core_ext/deep_merge.rb