[ANN] One-Click Ruby Installer 1.8.2-14 RC8 for Windows

Is there a way to determine what method you are in?

class myApp
    def mydef
       error = true;
       raise "#{self.class} : #{self.calling_method} error
    end
end

Something like the #{self.calling_method} above perhaps?

Try using Kernel.caller:

caller(0)[0].scan /`(.*?)'/
method = $1

Thanks,

Zach

Sam

···

On Wed, 18 Aug 2004 10:32:18 +0900, Zach Dennis <zdennis@mktec.com> wrote:

You can use Kernel.caller to get the execution stack. The first item
will be the current method.
http://phrogz.net/ProgrammingRuby/ref_m_kernel.html#Kernel.caller
Happy rubying...
  -CWS

···

On Wed, 18 Aug 2004 10:32:18 +0900, Zach Dennis <zdennis@mktec.com> wrote:

Is there a way to determine what method you are in?

class myApp
    def mydef
       error = true;
       raise "#{self.class} : #{self.calling_method} error
    end
end

Something like the #{self.calling_method} above perhaps?

Thanks,

Zach