End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
IO::generic_readable#read_nonblock
strio.read_nonblock(integer[, outbuf [, opts]]) → string
ext/stringio/stringio.c
View on GitHub ↗
static VALUE
strio_read_nonblock(int argc, VALUE *argv, VALUE self)
{
VALUE opts = Qnil, val;
rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
if (!NIL_P(opts)) {
argc--;
}
val = strio_read(argc, argv, self);
if (NIL_P(val)) {
if (!NIL_P(opts) &&
rb_hash_lookup2(opts, sym_exception, Qundef) == Qfalse)
return Qnil;
else
rb_eof_error();
}
return val;
}
Similar to read, but raises EOFError at end of string unless the +exception: false+ option is passed in.