Skip to content

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

instance method

Kernel#readlines

readlines(sep=$/) → array
readlines(limit) → array
readlines(sep, limit) → array

Returns an array containing the lines returned by calling Kernel.gets(<i>sep</i>) until the end of file.

See also #readline #require #Rational #require_relative also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0