End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
StringIO#rewind
strio.rewind → 0
ext/stringio/stringio.c
View on GitHub ↗
static VALUE
strio_rewind(VALUE self)
{
struct StringIO *ptr = StringIO(self);
ptr->pos = 0;
ptr->lineno = 0;
return INT2FIX(0);
}
Positions the stream to the beginning of input, resetting lineno to zero.