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

ios.sync → true or false

Returns the current “sync mode” of ios. When sync mode is true, all output is immediately flushed to the underlying operating system and is not buffered by Ruby internally. See also IO#fsync.

Example
f = File.new("testfile")
f.sync   #=> false
See also #sync= #stat #set_encoding_by_bom #sysread also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1