From: 7stud -- Date: 2009-04-29T08:42:11+09:00 Subject: Re: Opposite of initialize Hassan Schroeder wrote: > On Tue, Apr 28, 2009 at 10:10 AM, Robert Klemme > wrote: > >>>> I'm looking for the opposite function of initialize() as I need to >>>> call something before an object is "destroyed". > >> And the finalizer is called *after* the object has gone! > > So "before" it's destroyed and "after" it's destroyed are two different > things. > Not only that: 1) "it goes out of scope and there are no more references to the object so the object is ready to be garbage collected" and 2) "the object is actually garbage collected and destroyed" are two different things. The actual destruction may happen only after your program ends. -- Posted via http://www.ruby-forum.com/.