From: Austin Ziegler Date: 2007-02-20T09:00:28+09:00 Subject: Re: Deconstructor to close file On 2/19/07, Raymond O'connor wrote: > I'm trying to write a logger class. I open the file in the initialize > method. Is there a destructor that I can override to close the file, or > can I just assume the file is closed automatically? > > Am I going about this all wrong, and should instead just open and close > the file each time I write to it? There is no meaningful concept of a destructor in Ruby. There are finalizers, but they're not guaranteed to be called. Rather than trying to write your own logger class, why don't you look at Log4R? -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca