Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
IO#flush
() -> self
flush → self
io.c
View on GitHub ↗
VALUE
rb_io_flush(VALUE io)
{
return rb_io_flush_raw(io, 1);
}
Flushes data buffered in self to the operating system (but does not necessarily flush data buffered in the operating system):
Example
$stdout.print 'no newline' # Not necessarily flushed. $stdout.flush # Flushed.