From: botp Date: 2008-08-02T01:05:08+09:00 Subject: Re: Get the caller of a class On Fri, Aug 1, 2008 at 10:25 PM, Mario Ruiz wrote: > I know that way.... but I would like to know if it is possible to do it > without passing the argument to the method. :) try #caller botp@jedi-hopeful:~$ qri caller ---------------------------------------------------------- Kernel#caller caller(start=1) => array ------------------------------------------------------------------------ Returns the current execution stack---an array containing strings in the form ``file:line'' or ``file:line: in `method'''. The optional start parameter determines the number of initial stack entries to omit from the result. def a(skip) caller(skip) end def b(skip) a(skip) end def c(skip) b(skip) end c(0) #=> ["prog:2:in `a'", "prog:5:in `b'", "prog:8:in `c'", "prog:10"] c(1) #=> ["prog:5:in `b'", "prog:8:in `c'", "prog:11"] c(2) #=> ["prog:8:in `c'", "prog:12"] c(3) #=> ["prog:13"] hth. kind regards -botp