eric / badtux.org (Eric Lee Green) writes:

> Destructors are useful for more than memory allocation. For example,
> in a large Python program that I wrote some time ago, there is a class
> that when instantiated creates several temporary named pipes in
> /tmp. It has various methods that do various things to those files
> (such as start up some programs that talk through those named pipes),
> then it has a has a "cleanup" method to clean up those files, but if
> the program abends (let's say an exception is thrown) I want those
> files to go away. Otherwise they hang around in /tmp cluttering things
> up for days.  Not Good.
>... 
> Is there any way I can handle this sort of thing in Ruby?

You might want to look at the tempfile.rb standard library package for
a way to use finalizers to do just this.

Regards

Dave