From: Jesse Merriman Date: 2007-07-23T11:17:35+09:00 Subject: Re: Overriding delegated methods On Sunday 22 July 2007 15:20, Pit Capitain wrote: > 2007/7/22, Jesse Merriman : > > (...) The solution that came to my mind > > was to create a delegating class that counts how many times #puts has been > > called, and restarts the process by killing the old wrapper object and creating > > a new one (...) > > Thanks for the explanation. In this case you could try something like this: > > require 'delegate' > > Note how the A instance changes every three calls. The counter > increases both for internal and external calls. You can call the > original method with "super". Yep, that works just how I want it. I don't particularly like having to define #bar everytime it restarts, but it'll do. Thanks, Pit. -- Jesse Merriman jessemerriman@warpmail.net http://www.jessemerriman.com/