Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Enumerable#to_a

to_a(*args) → array

Returns an array containing the items in self:

Example
(0..4).to_a # => [0, 1, 2, 3, 4]
See also #tally #to_h #take_while #to_set also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0