enum.collect { |obj| block } â array
enum.collect â an_enumerator
enum.collect â an_enumerator
Instance Public methods
Returns a new array with the results of running block once for every element in enum.
If no block is given, an enumerator is returned instead.
(1..4).collect { |i| i*i } #=> [1, 4, 9, 16] (1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
Please login to continue.