From: Eric Hodel Date: 2006-02-15T07:34:27+09:00 Subject: Re: Rescuing blocks? On Feb 12, 2006, at 10:55 AM, Daniel Nugent wrote: > Whoops, shoulda thought of that, a-doy. > > Okay, it's pretty simple, here's what I'd like to do (you can > extrapolate the rest of the syntax from the simple example): > > foo = [1, 2, 3] > > foo.each do |o| > raise "Oh noes, it's number 2!" if o == 2 > rescue Exception => e > puts e.to_s > end > > And so on and so forth. It seems pretty natural to me.... I don't > think it breaks anything (least not off the top of my head)... You're going to get a performance hit setting up an exception trap this way. -- Eric Hodel - drbrain@segment7.net - http://segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com