instance method
ARGF#readline
ARGF.readline(sep=$/) → string
ARGF.readline(limit) → string
ARGF.readline(sep, limit) → string
io.c
View on GitHub ↗
static VALUE
argf_readline(int argc, VALUE *argv, VALUE argf)
{
VALUE line;
if (!next_argv()) rb_eof_error();
ARGF_FORWARD(argc, argv);
line = argf_gets(argc, argv, argf);
if (NIL_P(line)) {
rb_eof_error();
}
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.
An EOFError is raised at the end of the file.