Method: Array#collect
- Defined in:
- array.c
#collect {|item| ... } ⇒ Array #map {|item| ... } ⇒ Array
Invokes block once for each element of self. Creates a new array containing the values returned by the block. See also Enumerable#collect.
a = [ "a", "b", "c", "d" ]
a.collect {|x| x + "!" } #=> ["a!", "b!", "c!", "d!"]
a #=> ["a", "b", "c", "d"]
1699 1700 1701 |
# File 'array.c', line 1699 static VALUE rb_ary_collect(ary) VALUE ary; |