End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Kernel#readline
readline(sep=$/) → string
readline(limit) → string
readline(sep, limit) → string
io.c
View on GitHub ↗
static VALUE
rb_f_readline(int argc, VALUE *argv, VALUE recv)
{
if (recv == argf) {
return argf_readline(argc, argv, argf);
}
return forward(argf, rb_intern("readline"), argc, argv);
}
Equivalent to Kernel::gets, except readline raises EOFError at end of file.