Created
October 8, 2014 06:14
-
-
Save pranav7/10d22291aadb0c32ded3 to your computer and use it in GitHub Desktop.
Finding the exact location of a method in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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