Sha256: 29914f540e1c9ab8f92c5537be56ea86d429db96e4612ad2715e6dabcb066d3d

Contents?: true

Size: 740 Bytes

Versions: 14

Compression:

Stored size: 740 Bytes

Contents

module Raven
  module Utils
    # ported from ActiveSupport
    module DeepMergeHash
      def self.deep_merge(hash, other_hash, &block)
        deep_merge!(hash, other_hash, &block)
      end

      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)
            this_value.deep_merge(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
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
sentry-raven-2.1.4 lib/raven/utils/deep_merge.rb
sentry-raven-2.1.3 lib/raven/utils/deep_merge.rb
sentry-raven-2.1.2 lib/raven/utils/deep_merge.rb
sentry-raven-2.1.1 lib/raven/utils/deep_merge.rb
sentry-raven-2.1.0 lib/raven/utils/deep_merge.rb
sentry-raven-2.0.2 lib/raven/utils/deep_merge.rb
sentry-raven-2.0.1 lib/raven/utils/deep_merge.rb
sentry-raven-2.0.0 lib/raven/utils/deep_merge.rb
sentry-raven-1.2.3 lib/raven/utils/deep_merge.rb
sentry-raven-1.2.2 lib/raven/utils/deep_merge.rb
sentry-raven-1.2.1 lib/raven/utils/deep_merge.rb
sentry-raven-1.2.0 lib/raven/utils/deep_merge.rb
sentry-raven-1.1.0 lib/raven/utils/deep_merge.rb
sentry-raven-1.0.0 lib/raven/utils/deep_merge.rb