3 ms·
> I hate that I can't easy determine where a given method of an arbitrary object is defined. https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.htm
by lcnPylGDnU4H9OF 4y ago
> I hate that I can't easy determine where a given method of an arbitrary object is defined.
https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debugger...
The relevant bit is under the heading:
> I’m calling a method, but I don’t know where it goes
def index
p method(:render).source_location
render params[:id]
end
It sounds like this is the answer to your monkey-patching woes.
my_object.method(:my_method).source_location # returns /path/to/file.rb:[line number]