From: "Mauricio Fernández" Date: 2003-05-21T14:51:40+09:00 Subject: Re: An Object Going Out Of Scope On Wed, May 21, 2003 at 05:14:06AM +0900, MikkelFJ wrote: > > "Jim Weirich" wrote in message > news:1053406677.17559.8.camel@traken... > > > How about this syntax ... > > > > auto(foo=MyObject.new, :cleanup) do > > # use foo > > end > > fine if you can handle multiple objects this way. Mauricios suggestion does > that, but does not allow you to specify cleanup method. This, of course can > be done in many ways. It seems you overlooked the fact that it is not implementable in current Ruby, for it needs Procs to be rebound :) It'd be easy to change it to specify the cleanup method, should it run at all. def auto(hash) ... end and then auto( :a => :finalize, :file => close ) do file = File.new("/tmp/bla") a = Something.new end -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com #Debian makes me feel all warm and fuzzy inside. :) -- HippieGuy on #Debian