Sha256: c3dd1c86264c76e42d48cddc946366fa40b3e5fea3052467095036f95f5f0bad

Contents?: true

Size: 417 Bytes

Versions: 7

Compression:

Stored size: 417 Bytes

Contents

module Buff
  module Extensions::Hash
    module ReverseMerge
      # @param [Hash] other
      #
      # @return [Hash]
      def reverse_merge(other)
        other.merge(self)
      end

      # @param [Hash] other
      #
      # @return [Hash]
      def reverse_merge!(other)
        merge!(other) { |key, old, new| old }
      end
    end
  end
end

class Hash
  include Buff::Extensions::Hash::ReverseMerge
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
buff-extensions-2.0.0 lib/buff/extensions/hash/reverse_merge.rb
buff-extensions-1.0.0 lib/buff/extensions/hash/reverse_merge.rb
buff-extensions-0.5.0 lib/buff/extensions/hash/reverse_merge.rb
buff-extensions-0.4.0 lib/buff/extensions/hash/reverse_merge.rb
buff-extensions-0.3.1 lib/buff/extensions/hash/reverse_merge.rb
buff-extensions-0.3.0 lib/buff/extensions/hash/reverse_merge.rb
buff-extensions-0.2.0 lib/buff/extensions/hash/reverse_merge.rb