static VALUE
strio_each(int argc, VALUE *argv, VALUE self)
{
struct StringIO *ptr = StringIO(self);
VALUE line;
RETURN_ENUMERATOR(self, argc, argv);
if (argc > 0 && !NIL_P(argv[argc-1]) && NIL_P(rb_check_string_type(argv[argc-1])) &&
NUM2LONG(argv[argc-1]) == 0) {
rb_raise(rb_eArgError, "invalid limit: 0 for each_line");
}
while (!NIL_P(line = strio_getline(argc, argv, readable(ptr)))) {
rb_yield(line);
}
return self;
}