Sha256: 0cea370b518ccaec13b76eb9994f5fc91a3f5487fa7f5d73ee198bae8994dfc9

Contents?: true

Size: 407 Bytes

Versions: 8

Compression:

Stored size: 407 Bytes

Contents

module PactBroker
  module HashRefinements
    refine Hash do
      def deep_merge(other_hash, &block)
        block_actual = Proc.new {|key, oldval, newval|
            newval = block.call(key, oldval, newval) if block_given?
            [oldval, newval].all? {|v| v.is_a?(Hash)} ? oldval.merge(newval, &block_actual) : newval
        }
        merge(other_hash, &block_actual)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact_broker-2.40.0 lib/pact_broker/hash_refinements.rb
pact_broker-2.39.0 lib/pact_broker/hash_refinements.rb
pact_broker-2.38.1 lib/pact_broker/hash_refinements.rb
pact_broker-2.38.0 lib/pact_broker/hash_refinements.rb
pact_broker-2.37.0 lib/pact_broker/hash_refinements.rb
pact_broker-2.36.1 lib/pact_broker/hash_refinements.rb
pact_broker-2.36.0 lib/pact_broker/hash_refinements.rb
pact_broker-2.35.0 lib/pact_broker/hash_refinements.rb