Sha256: 498a6c0d34745e25a120f90e35fbd34a6417599087974f7920e2edf38d949e18

Contents?: true

Size: 440 Bytes

Versions: 4

Compression:

Stored size: 440 Bytes

Contents

module HashHelpers
  def deep_merge(other)
    merge(other) do |key, old_value, new_value|
      Hash === old_value ? Hash === new_value ? old_value.deep_merge(new_value) : new_value : new_value
    end
  end

  def deep_merge!(other)
    merge!(other) do |key, old_value, new_value|
      Hash === old_value ? Hash === new_value ? old_value.deep_merge!(new_value) : new_value : new_value
    end
  end
end

Hash.send :include, HashHelpers

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nswtopo-3.0.1 lib/nswtopo/helpers/hash.rb
nswtopo-3.0 lib/nswtopo/helpers/hash.rb
nswtopo-2.0.0 lib/nswtopo/helpers/hash.rb
nswtopo-2.0.0.pre.beta1 lib/nswtopo/helpers/hash.rb