Sha256: bb85c942933b0b4c33ed36103c4a57ae9bf35206ba52a3902202a4fe6f9c7928

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 Bytes

Contents

# Extend Hash with recursive merging abilities
class Hash
  # Deep merge method. Silly name prevents overwriting other implementations.
  #
  # Inspired from:
  # http://www.gemtacular.com/gemdocs/cerberus-0.2.2/doc/classes/Hash.html
  # File lib/cerberus/utils.rb, line 42
  def yaml_pack_deep_merge!(second)
    second.each_pair do |k,v|
      if self[k].is_a?(Hash) and second[k].is_a?(Hash)
        self[k].yaml_pack_deep_merge!(second[k])
      else
        self[k] = second[k]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yaml_pack-0.0.2.alpha lib/core_ext/hash.rb
yaml_pack-0.0.1.beta lib/core_ext/hash.rb
yaml_pack-0.0.1.alpha lib/core_ext/hash.rb