From: Mat Schaffer Date: 2006-12-24T12:08:22+09:00 Subject: Re: Reverting module changes On 12/23/06, Michal Kwiatkowski wrote: > Hi, > > I want to mock standard Kernel.system with my own method and then > revert back to the original version. I was able to do the former, but > not the latter. Currently I'm overwriting Kernel.system method > definition with: > > def system_should_return what > Kernel.module_eval "def system(*args) #{what.inspect} end" > end > > I don't a have idea how going back to the original state can be done. > Thanks in advance for any help on this. Maybe there's something more elegant. But I'd first alias the original method, redefine it, then when I was done, I'd redefine it again to just call the alias. -Mat