DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Ruby - Writing To File

06.25.2009
| 16316 views |
  • submit to reddit
        // Easy method for quickly writing to file

File.open('/tmp/ruby-write-test.txt', 'w') do |f|
  f.puts 'test started at #{Time.now}'
  # ... do something
  f.puts 'test ended at #{Time.now}'
end