From: Jan Svitok Date: 2006-09-08T00:23:10+09:00 Subject: Re: Has a method been called? On 9/7/06, aidy wrote: > Hi, > Is it possible to find out if a method has been called except by adding > a flag to it? > > class Whatever > @flag = 0 > > def method_called > @flag += 1 > end > > def has_method_been_called > false > return true if @flag > 0 > end > > end > > Cheers > > Aidy If it's enough for you to know that off-line, you can use rcov or ruby-prof for that. Run rcov and see whether it's code was visited. If you need to know in the runtime, that's another story ;-)