From: David Alan Black Date: 2002-07-24T00:32:12+09:00 Subject: Re: define_method with super in the proc Hi -- On Wed, 24 Jul 2002, Tom Sawyer wrote: > Mr. Ogata, > > very nice! very nice indeed. > > thank you, > transami > > > On Tue, 2002-07-23 at 09:06, George Ogata wrote: > > class A > > def doit > > @x = 5 > > end > > end > > > > def makeproc > > '; super; @y = 10' > > #^ args can go before here > > end > > > > B = Class.new(A) > > B.class_eval "def doit #{makeproc}; end" > > > > b = B.new > > b.doit > > p b > > > > produces: > > > > # I'm losing sight of the goal here. What's the advantage of this kind of indirectness and extra work, when you can just write the code? class B < A def doit super @y = 10 end end Normally I would assume that a small example is encapsulating something that one would want to do one a larger scale, but I'm not sure what that would be here. (By "here" I mean the question raised in the whole thread, not just this example.) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav