Today I Learned

hashrocket A Hashrocket project

Return the current execution stack in ruby

You can see the current execution stack with the caller method in ruby. It will show you where the currently executing method is called.

def my_method
  call_me
end

def call_me
  puts caller
end


my_method


#=> 
#_:2:in `foo'
#_:7:in `<main>'
See More #ruby TILs
Looking for help? Each developer at Hashrocket has years of experience working with Ruby applications of all types and sizes. We're an active presence at Ruby conferences, have written some of the most popular gems, and have worked on many of the web's Ruby on Rails success stories. Contact us today to talk about your Ruby project.