Sha256: f3318123ffa13ba4a060b9c6033150196ba8ed6bab296ac748822145dd6f2ea1

Contents?: true

Size: 783 Bytes

Versions: 8

Compression:

Stored size: 783 Bytes

Contents

# rubocop:disable all
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
# rubocop:enable all

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sentry-raven-2.5.3 lib/raven/utils/deep_merge.rb
sentry-raven-2.5.2 lib/raven/utils/deep_merge.rb
sentry-raven-2.5.1 lib/raven/utils/deep_merge.rb
sentry-raven-2.5.0 lib/raven/utils/deep_merge.rb
sentry-raven-2.4.0 lib/raven/utils/deep_merge.rb
sentry-raven-2.3.1 lib/raven/utils/deep_merge.rb
sentry-raven-2.3.0 lib/raven/utils/deep_merge.rb
sentry-raven-2.2.0 lib/raven/utils/deep_merge.rb