Last active
December 17, 2015 22:39
-
-
Save mingliangfeng/5683419 to your computer and use it in GitHub Desktop.
show source files of a class or method
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
find_source = lambda do |clazz, include_super=false| | |
files = clazz.methods(include_super).inject([]) {|c, m| c << clazz.method(m).source_location.first if clazz.method(m) and clazz.method(m).source_location; c } | |
files.uniq | |
end | |
puts find_source.call(Rails) | |
puts self.method(:get).source_location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment