From: Robert Date: 2003-03-21T17:21:15+09:00 Subject: Re: class level Exception handling "Mauricio Fern�ndez" schrieb im Newsbeitrag news:20030320202229.GB15038@student.ei.uni-stuttgart.de... > On Fri, Mar 21, 2003 at 02:58:15AM +0900, Robert Klemme wrote: > > Did I miss something or do you store the same block in @block for each > > method? If so, why? The original poster wanted to have a single error > > handler for all methods. > > I thought he could perhaps change his mind :) :-)) > I'm not doing that however cause I'm getting a very strong 'd�j� vu' > feeling, after writing KeywordProcessor and NoOverloading ;-) > I mean, I love playing with singleton classes and so, but using the same > tricks again a again spoils the fun. I see. The fun thing plays an important role when doing ruby - it's so much fun doing things in ruby that are much more difficult in other languages. :-)) > Could be useful; the following too: > rescue Exception > return self.class.__block__(:#{meth.to_s}).call([:#{meth.to_s}, block] + args) > end > > wrap :foo, :bar, :baz do |meth, block, *args| > puts "Got #{$!.inspect} when calling #{meth} with args #{args.inspect}" > # can moreover do something with block > end Si. Although this tends again into the direction of doing method specific error handling. :-) Regards robert