End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Array#reverse!
array.reverse! → self
array.c
View on GitHub ↗
static VALUE
rb_ary_reverse_bang(VALUE ary)
{
return rb_ary_reverse(ary);
}
Reverses self in place:
Example
a = ['foo', 'bar', 'two'] a.reverse! # => ["two", "bar", "foo"]