From: "Mauricio Fernández" Date: 2003-05-21T21:45:40+09:00 Subject: Re: An Object Going Out Of Scope On Wed, May 21, 2003 at 09:24:37PM +0900, nobu.nokada@softhome.net wrote: > Hi, > > At Wed, 21 May 2003 18:57:31 +0900, > Mauricio Fern�ndez wrote: > > def auto(*vars, &block) > > begin > > block.rebind(binding).call # rebind not in Ruby!!! > > ensure > vars.each { |x| eval "#{x}.cleanup if #{x}", block } Nice! For the record: It works the other way around: instead of trying to define the vars in the begin...end scope, it destroys the ones inside the proc. Thanks! > > end > > end -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com LILO, you've got me on my knees! -- David Black, dblack@pilot.njin.net, with apologies to Derek and the Dominos, and Werner Almsberger