Method: Array#collect!

Defined in:
array.c

#collect! {|item| ... } ⇒ Array #map! {|item| ... } ⇒ Array

Invokes the block once for each element of self, replacing the element with the value returned by block. See also Enumerable#collect.

a = [ "a", "b", "c", "d" ]
a.collect! {|x| x + "!" }
a             #=>  [ "a!", "b!", "c!", "d!" ]

Overloads:

  • #collect! {|item| ... } ⇒ Array

    Yields:

    • (item)

    Returns:

  • #map! {|item| ... } ⇒ Array

    Yields:

    • (item)

    Returns:



1731
1732
1733
# File 'array.c', line 1731

static VALUE
rb_ary_collect_bang(ary)
VALUE ary;