A fair question, and one we ask ourselves regularly. Mental lapses
aside, in Ruby at least you can find out exactly ``how you got there''
by using the method
caller,
which returns an
Array of
String objects representing the current call stack.
def catA
puts caller.join("\n")
end
def catB
catA
end
def catC
catB
end
catC
|
produces:
prog.rb:5:in `catB'
prog.rb:8:in `catC'
prog.rb:10
|
Once you've figured out how you got there, where you go next is up to
you.