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

* enum.c (group_by): Improve documentation based on patch by b t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-10-06 01:01:22 +00:00
parent e2974b1a4b
commit 8f6cb4b473
2 changed files with 9 additions and 5 deletions

View file

@ -1,7 +1,11 @@
Thu Oct 6 10:00:54 2011 Eric Hodel <drbrain@segment7.net>
* enum.c (group_by): Improve documentation based on patch by b t.
Thu Oct 6 09:56:30 2011 Eric Hodel <drbrain@segment7.net> Thu Oct 6 09:56:30 2011 Eric Hodel <drbrain@segment7.net>
* enum.c: Clean up wording in Enumerable documentation. Patch by b t. * enum.c: Clean up wording in Enumerable documentation. Patch by b t.
[Ruby 1.9 - Bug #5411 [Ruby 1.9 - Bug #5411]
Thu Oct 6 09:17:18 2011 Eric Hodel <drbrain@segment7.net> Thu Oct 6 09:17:18 2011 Eric Hodel <drbrain@segment7.net>

8
enum.c
View file

@ -657,11 +657,11 @@ group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv)
* enum.group_by {| obj | block } -> a_hash * enum.group_by {| obj | block } -> a_hash
* enum.group_by -> an_enumerator * enum.group_by -> an_enumerator
* *
* Returns a hash, which keys are evaluated result from the * Groups the collection by result of the block. Returns a hash where the
* block, and values are arrays of elements in <i>enum</i> * keys are the evaluated result from the block and values the values are
* corresponding to the key. * arrays of elements in the collection that corresponding to the key.
* *
* If no block is given, an enumerator is returned instead. * If no block is given an enumerator is returned.
* *
* (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]} * (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}
* *