End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
IO#ready?
io.ready? → true or false
ext/io/wait/wait.c
View on GitHub ↗
static VALUE
io_ready_p(VALUE io)
{
rb_io_t *fptr;
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
if (rb_io_read_pending(fptr)) return Qtrue;
return io_wait_event(io, RUBY_IO_READABLE, RB_INT2NUM(0));
}
Returns true if input available without blocking, or false.