map

enum.map { |obj| block } â array
enum.map â 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"]
doc_ruby_on_rails
2015-04-05 00:53:52
Comments
Leave a Comment

Please login to continue.