method
group_by
Ruby latest stable (v1_9_3_392)
-
0 notes -
Class: Enumerable
group_by()
public
Returns a hash, which keys are evaluated result from the block, and values are arrays of elements in enum corresponding to the key.
If no block is given, an enumerator is returned instead.
(1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}


