Module: Polyfill::V2_6::Hash

Defined in:
lib/polyfill/v2_6/hash.rb

Instance Method Summary collapse

Instance Method Details

#merge(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/polyfill/v2_6/hash.rb', line 4

def merge(*args)
  if block_given?
    block = ::Proc.new

    args.each_with_object(dup) do |arg, h|
      h.merge!(arg, &block)
    end
  else
    args.each_with_object(dup) do |arg, h|
      h.merge!(arg)
    end
  end
end