From: Simon Strandgaard Date: 2004-01-21T23:00:06+09:00 Subject: Re: enable debugflag in module On Wed, 21 Jan 2004 08:20:00 +0900, nobu.nokad wrote: > At Wed, 21 Jan 2004 06:55:01 +0900, > Simon Strandgaard wrote: >> class Object >> # enable the global debug flag for just a single method >> def self.debug(*args) > > Should be Module's instance method. > >> #{org}#{arguments} >> $stdout.puts("after ##{name}") > > This discards the result of the original method. ok > And you'd better to check the method already "debugged" to get > rid of infinite recursion. I have briefly thought about this, but didn't knew how/where to begin. But you have solved it! Thanks. [snip] > alias_method org, name > module_eval %{ ^^^^ NICE.. wasn't aware of this. > def #{name}(*a, &b) ^^^^^^^^ By doing so, then Test::Unit rejects the method. I use #{name}#{arguments}. Educational.. Now 'debug' is even more useful. Thanks Nobu. -- Simon Strandgaard