method

collect

Importance_1
Ruby latest stable (v1_8_7_72) - 0 notes - Class: Enumerable
collect() public

Returns a new array with the results of running block once for every element in enum.

   (1..4).collect {|i| i*i }   #=> [1, 4, 9, 16]
   (1..4).collect { "cat"  }   #=> ["cat", "cat", "cat", "cat"]
Show source
Register or log in to add new notes.