lib/polyfill/v2_6/hash.rb in polyfill-1.6.0 vs lib/polyfill/v2_6/hash.rb in polyfill-1.7.0
- old
+ new
@@ -12,8 +12,36 @@
args.each_with_object(dup) do |arg, h|
h.merge!(arg)
end
end
end
+
+ def merge!(*args)
+ if block_given?
+ block = ::Proc.new
+
+ args.each_with_object(self) do |arg, h|
+ h.merge!(arg, &block)
+ end
+ else
+ args.each_with_object(self) do |arg, h|
+ h.merge!(arg)
+ end
+ end
+ end
+
+ def update(*args)
+ if block_given?
+ block = ::Proc.new
+
+ args.each_with_object(self) do |arg, h|
+ h.update(arg, &block)
+ end
+ else
+ args.each_with_object(self) do |arg, h|
+ h.update(arg)
+ end
+ end
+ end
end
end
end