Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Range#entries

rng.entries → array

Alias of #to_a

Returns an array containing the items in the range.

Example
(1..7).to_a  #=> [1, 2, 3, 4, 5, 6, 7]
(1..).to_a   #=> RangeError: cannot convert endless range to an array
See also #to_a #end #eql? #each also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1