From: "Pedro CĂ´rte-Real" Date: 2006-07-28T02:20:28+09:00 Subject: Re: Wrapped method causing infinite recursion in rcov On 7/27/06, Caleb Clausen wrote: > At a guess, (something is) rcov is also wrapping #get and using the > same name for the old version of the method. At least, that's always > been the explanation when I've encountered these 'wrapping a method > causes infinite recursion' problems. Try this way instead, it should > eliminate any possibility that your code is participating in the > recursion. I tried a different name and it didn't work so I don't know what's actually happening. But I'd like to know. Anyone? > old_get=instance_method(:get) > define_method(:get) do |*args| > old_get[*args] I had to replace this line with: old_get.bind(self).call(*args) apparently old_get is an UnboundMethod and needs to be bound to an object before it can work. > if @response.success? > assert_valid_markup > end > end Thanks for this solution. It's working again now. This probably means that there should be an alias_method equivalent to do this. I didn't really want to change the method name, I wanted to replace it with something that could still call the old behavior. 0-step inheritance so to speak. > This trick was originated by Mauricio Fernandez, as far as I know. Thanks to him too then, Pedro.