Skip to content

Instantly share code, notes, and snippets.

@fj
Created May 27, 2010 19:16
Show Gist options
  • Save fj/416218 to your computer and use it in GitHub Desktop.
Save fj/416218 to your computer and use it in GitHub Desktop.
require 'tempfile'
t = Tempfile.new('test-data')
t.open
t.sync = true
t << "apples"
t.puts "bananas"
# prints "contents are [] (14 bytes)"
puts "contents are [#{t.read}] (#{t.size} bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment