"Kaspar Schiess" <eule / space.ch> schrieb im Newsbeitrag news:chp75o$4gp$1 / sea.gmane.org... > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Charles Hixson wrote: > > | I want to have a class which occasionally updates a file, but I want to > | ensure that it always flushes it's data to the file before the program > | quits. > > Not quite sure if I really understand your problem, but I might offer > some things to consider here: > > 1. stream.sync= true for enabling autoflush. Is this not possible ? This > seems to be the simplest solution. > > 2. Use Ruby's block syntax to 'ensure' flush after update. Yeah, but it really depends on the usage pattern: I'm not sure whether a) the file is overwritten on every access and b) how often these updates take place. Charles, can you clarify? > 3. At exit of ruby program, all Files should be flushed anyhow, correct > me on this if I am mistaken. Hm, I would have guessed otherwise but apparently you are right: 12:00:34 [source]: ruby -e 'io=File.open("x", "w");io.sync = false;io.print "hello"' 12:00:53 [source]: cat x hello12:00:55 [source]: Kind regards robert