Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

IO#wait

io.wait(events, timeout) → event mask or false.
io.wait(timeout = nil, mode = :read) → event mask or false.

Waits until the IO becomes ready for the specified events and returns the subset of events that become ready, or false when times out.

The events can be a bit mask of IO::READABLE, IO::WRITABLE or IO::PRIORITY.

Returns true immediately when buffered data is available.

Optional parameter mode is one of :read, :write, or :read_write.

See also #ungetc #wait_priority #ungetbyte #wait_readable also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1