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

[DOC] add explanation for Array#sum

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2016-11-05 02:50:15 +00:00
parent a2f3069988
commit 8afd5857f0

View file

@ -5717,7 +5717,8 @@ rb_ary_dig(int argc, VALUE *argv, VALUE self)
* ["a", "b", "c"].sum("") #=> "abc"
* [[1], [[2]], [3]].sum([]) #=> [1, [2], 3]
*
* However, Array#join and Array#flatten is faster than Array#sum.
* However, Array#join and Array#flatten is faster than Array#sum for
* array of strings and array of arrays.
*
* ["a", "b", "c"].join #=> "abc"
* [[1], [[2]], [3]].flatten(1) #=> [1, [2], 3]