Sha256: 2091355498d3903270e0039eaf6dd542d24e38bb5133e956aa3c433a863d9ba3

Contents?: true

Size: 453 Bytes

Versions: 1

Compression:

Stored size: 453 Bytes

Contents

class Hash
  # Copied from active_support
  # http://apidock.com/rails/Hash/deep_merge%21
  def deep_merge!(other_hash, &block)
    other_hash.each_pair do |k,v|
      tv = self[k]
      if tv.is_a?(Hash) && v.is_a?(Hash)
        self[k] = tv.deep_merge(v, &block)
      else
        self[k] = block && tv ? block.call(k, tv, v) : v
      end
    end
    self
  end

  def deep_merge(other_hash, &block)
    dup.deep_merge!(other_hash, &block)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lite_config-0.0.4 lib/lite_config/hash.rb