View Single Post
  #7 (permalink)  
Old 03-31-2008, 09:51 PM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: Ruby BuiltIn functions

caller
caller( [ anInteger ] ) -> anArray


Returns the current execution stack---an array containing strings in the form ``file:line'' or ``file:line: in `method'''. The optional anInteger 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"]
__________________
Shaalini.S
Be the Best of Whatever you are...
Reply With Quote