Refactoring for Enumerable#each_with_object

`each_with_object` arity should be 1
This commit is contained in:
ksss
2018-03-27 23:09:10 +09:00
parent a072015c4e
commit e683c95e90
+1 -3
View File
@@ -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) }