instance method
ARGF#pos=
ARGF.pos = position → Integer
io.c
View on GitHub ↗
static VALUE
argf_set_pos(VALUE argf, VALUE offset)
{
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to set position");
}
ARGF_FORWARD(1, &offset);
return rb_io_set_pos(ARGF.current_file, offset);
}
Seeks to the position given by position (in bytes) in ARGF.
For example:
Example
ARGF.pos = 17 ARGF.gets #=> "This is line two\n"