End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
ARGF#gets
ARGF.gets(sep=$/ [, getline_args]) → string or nil
ARGF.gets(limit [, getline_args]) → string or nil
ARGF.gets(sep, limit [, getline_args]) → string or nil
io.c
View on GitHub ↗
static VALUE
argf_gets(int argc, VALUE *argv, VALUE argf)
{
VALUE line;
line = argf_getline(argc, argv, argf);
rb_lastline_set(line);
return line;
}
Returns the next line from the current file in ARGF.
By default lines are assumed to be separated by $/; to use a different character as a separator, supply it as a String for the sep argument.
The optional limit argument specifies how many characters of each line to return. By default all characters are returned.
See IO.readlines for details about getline_args.