Skip to content

Instantly share code, notes, and snippets.

@fadhlirahim
Created November 14, 2011 08:14
Show Gist options
  • Save fadhlirahim/1363508 to your computer and use it in GitHub Desktop.
Save fadhlirahim/1363508 to your computer and use it in GitHub Desktop.
Create Tempfile
# Creates Tempfile
def ical_file
file = Tempfile.new("foo")
begin
file.path
file.write('foo')
file.rewind
file.read
ensure
file.close
file.unlink # deletes the temp file
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment