Sha256: bc5a3b8b3f270e05f1a1c19bd3388e4a66e7d2d9821e3d5b820fb851bf0b78d6

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

module Confrider
  class Vault < Hash
    # from active_support/core_ext/hash/deep_merge
    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) ? self.class.new(tv).deep_merge(v) : v
      end
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
confrider-0.2.0 lib/confrider/vault.rb