End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
StringIO#each
strio.each(sep=$/, chomp: false) {|line| block } → strio
strio.each(limit, chomp: false) {|line| block } → strio
strio.each(sep, limit, chomp: false) {|line| block } → strio
strio.each(...) → anEnumerator
ext/stringio/stringio.c
View on GitHub ↗
static VALUE
strio_each(int argc, VALUE *argv, VALUE self)
{
VALUE line;
struct getline_arg arg;
StringIO(self);
RETURN_ENUMERATOR(self, argc, argv);
if (prepare_getline_args(&arg, argc, argv)->limit == 0) {
rb_raise(rb_eArgError, "invalid limit: 0 for each_line");
}
while (!NIL_P(line = strio_getline(&arg, readable(self)))) {
rb_yield(line);
}
return self;
}
See IO#each.