Toby Rodwell wrote:
> I've learned that a very quick and easy way to save a Ruby object to a 
> file is to use YAML e.g.
> 
> 	def saveMyObject
> 		File.open(self.fileName,"a+") { |f|
> 			f.write(self.to_yaml)
> 			f.close
> 		}
> 	end

No-one mentioned it but the f.close in the File.open block
is not required--the whole idea behind the block is to use
it to close the file automatically after it has executed.


-- 
Posted via http://www.ruby-forum.com/.