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

Version Path
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_merge.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_merge.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
rails-uploader-0.0.4 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_merge.rb
activesupport-3.0.15 lib/active_support/core_ext/hash/deep_merge.rb
activesupport-3.1.6 lib/active_support/core_ext/hash/deep_merge.rb
activesupport-3.0.14 lib/active_support/core_ext/hash/deep_merge.rb
classiccms-0.3.8 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
challah-0.6.1 vendor/bundle/gems/activesupport-3.2.2/lib/active_support/core_ext/hash/deep_merge.rb
challah-0.6.1 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
challah-0.6.1 vendor/bundle/gems/activesupport-3.2.1/lib/active_support/core_ext/hash/deep_merge.rb
classiccms-0.3.7 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb
classiccms-0.3.6 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_merge.rb