debugging the call stack using puts and caller in ruby
October 9th, 2008 • Uncategorized
# call this anywhere inside a method
# it will print out the call stack for the current execution
# play with the numbers to narrow down the area of interest
def print_call_stack(method_name, from, to)
from.upto(to) { |i| p "#{method_name}[#{i}]: #{caller[i]}" }
end