Task

The goal is to get the source code or file path and line number where a programming object (e.g. module, class, function, method) is defined.




require 'mathn'
Math.method(:sqrt).source_location
# ["/usr/local/lib/ruby2.3/2.3.0/mathn.rb", 119]
 
Class.method(:nesting).source_location
# nil, since Class#nesting is native
 