End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
StringScanner#rest
rest
ext/strscan/strscan.c
View on GitHub ↗
static VALUE
strscan_rest(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
if (EOS_P(p)) {
return str_new(p, "", 0);
}
return extract_range(p, p->curr, S_LEN(p));
}
Returns the “rest” of the string (i.e. everything after the scan pointer). If there is no more data (eos? = true), it returns "".