Unverified Commit e683c95e authored by ksss's avatar ksss

Refactoring for `Enumerable#each_with_object`

`each_with_object` arity should be 1
parent a072015c
......@@ -610,9 +610,7 @@ module Enumerable
# #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
#
def each_with_object(obj=nil, &block)
raise ArgumentError, "wrong number of arguments (0 for 1)" if obj.nil?
def each_with_object(obj, &block)
return to_enum(:each_with_object, obj) unless block
self.each {|*val| block.call(val.__svalue, obj) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment