Skip to content

Instantly share code, notes, and snippets.

@pranav7
Created October 8, 2014 06:14
Show Gist options
  • Save pranav7/10d22291aadb0c32ded3 to your computer and use it in GitHub Desktop.
Save pranav7/10d22291aadb0c32ded3 to your computer and use it in GitHub Desktop.
Finding the exact location of a method in Ruby
# say you want to know the source location of a method :hai on the object O
# you can do
# a method in ruby is also an object. This returns the method object for method :hai
m = O.method(:hai)
# this will give you the exact location of the me
m.source_location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment