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#flush

ios.flush → ios

Flushes any buffered data within ios to the underlying operating system (note that this is Ruby internal buffering only; the OS may buffer the data as well).

Example
$stdout.print "no newline"
$stdout.flush

produces:

Example
no newline
See also #fileno #fsync #fdatasync #getbyte also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1