From: Vicente Bosch Campos Date: 2011-05-04T18:36:24+09:00 Subject: Re: Writing to a file Easiest way is to open a file for writing and with a block write the contents to it. File.open("test_file.txt", "a+") do |file| #opens the file "test_file.txt" in append mode, if it does not exist it creates it. file.puts "Hello world" end #closes the file for you Otherway is to use File.new but that forces you to ensure to close the file etc. Regards, Vicente On May 2, 2011, at 7:37 PM, Mike Jones wrote: > Hey guys, can anyone explain how to write to a file in Ruby? > > Thanks, > > Mike > > -- > Posted via http://www.ruby-forum.com/. >