Sha256: c63b8d701a7424ec7c04ef073ff52b2e347636312bee777796abd812de29fc4d

Contents?: true

Size: 795 Bytes

Versions: 7

Compression:

Stored size: 795 Bytes

Contents

# NOTE: This could probably be removed, but I don't have the time at the moment
#       determine that.  It is used by signature.rb, and these methods used to 
#       be in Savon.
#
module Akami
  module CoreExt
    module 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 unless defined? deep_merge!
    end
  end
end

Hash.send :include, Akami::CoreExt::Hash

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
akami-1.3.1 lib/akami/core_ext/hash.rb
akami-1.3.0 lib/akami/core_ext/hash.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/akami-1.2.2/lib/akami/core_ext/hash.rb
akami-1.2.2 lib/akami/core_ext/hash.rb
akami-1.2.1 lib/akami/core_ext/hash.rb
akami-1.2.0 lib/akami/core_ext/hash.rb
akami-1.1.0 lib/akami/core_ext/hash.rb