From: Mike Sassak Date: 2002-04-04T15:49:13+09:00 Subject: Re: File.write File.write already exists. File inherits from IO which implements #write. See http://www.rubycentral.com/book/ref_c_io.html#IO.write As for opening a file and saving the data when done, have you used blocks? You can do this: File.open("foo.txt"."a+") do |myFileHandle| # do stuff with myFile here end and when the block exits, the file is automatically closed. This is, of course, a bit longer than your proposed write method, but it's also much more flexible. HTH -mike On Wed, 2002-04-03 at 11:10, mengx@nielsenmedia.com wrote: > Hi, > > I remember that File.read was added a very convience class method. > I wonder what drawbacks would be for File.write or File.save to be > added. The API could be > > File.write(filename, wholedata, fsync=false) > > This would automattically close the file and optionally fsync data > > Or has it been added and I did not know? > > Thanks > > -Ted