I have this:
require 'tempfile'
t = Tempfile.new('test-data')
t.open
t.sync = true
t << "apples"
t.puts "bananas"
puts "contents are [#{t.read}] (#{t.size} bytes)"
t.close
This prints:
contents are [] (14 bytes)
Why aren't the contents actually shown? I'm on Ruby 1.9.2.