# module Raven::Utils::DeepMergeHash

ported from ActiveSupport

### Public Class Methods

deep_merge(hash, other_hash, &block) click to toggle source

    # File lib/raven/utils/deep_merge.rb, line 6
    def self.deep_merge(hash, other_hash, &block)
      deep_merge!(hash, other_hash, &block)
    end

deep_merge!(hash, other_hash, &block) click to toggle source

    # File lib/raven/utils/deep_merge.rb, line 10
    def self.deep_merge!(hash, other_hash, &block)
      other_hash.each_pair do |current_key, other_value|
        this_value = hash[current_key]

        hash[current_key] = if this_value.is_a?(Hash) && other_value.is_a?(Hash)
          deep_merge(this_value, other_value, &block)
        else
          if block_given? && key?(current_key)
            block.call(current_key, this_value, other_value)
          else
            other_value
          end
        end
      end

      hash
    end