Possible Duplicate:
How to get the name of the calling method?
How do I tell what method called foo in the following example?
class Example
def initialize
end
def foo
puts "Hello World"
end
def bar
foo
end
def cats
bar
end
end
Example.new.cats prints bar. I am trying to get the whole callstack. E.g. cats -> bar -> foo
Update:
This works: puts caller[0..1]
Hello World
(irb):11:in `bar'
(irb):15:in `cats'