1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Remove redundant each from sum example () [ci skip]

It used to be `Enumerator#sum`, now it's range of string which calls
`Enumerable#sum` and causes TypeError.
This commit is contained in:
OKURA Masafumi 2019-08-17 08:52:23 +09:00 committed by Takashi Kokubun
parent 7624154595
commit efd37f8fc3

2
enum.c
View file

@ -4017,7 +4017,7 @@ int_range_sum(VALUE beg, VALUE end, int excl, VALUE init)
* { 1 => 10, 2 => 20 }.sum {|k, v| k * v } #=> 50
* (1..10).sum #=> 55
* (1..10).sum {|v| v * 2 } #=> 110
* [Object.new].each.sum #=> TypeError
* ('a'..'z').sum #=> TypeError
*
* This method can be used for non-numeric objects by
* explicit <i>init</i> argument.