Last active
June 28, 2018 02:58
-
-
Save leemour/e4f31a16bfd25b15550a42831f08ddb7 to your computer and use it in GitHub Desktop.
Ruby reflections - find source location and source code
This file contains 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
# Show method location | |
method(:meth).source_location | |
# Nice gem 'method_source' makes life easier. Use it inside console: | |
require 'method_source' | |
# Show method source | |
method(:meth).source.display | |
# Show class or method definition | |
show-source Job | |
show-source Job.work |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment