method

sync=

v2_5_5 - Show latest stable - Class: IO
sync=(p1)
public

Sets the “sync mode” to true or false. When sync mode is true, all output is immediately flushed to the underlying operating system and is not buffered internally. Returns the new state. See also IO#fsync.

f = File.new("testfile")
f.sync = true