How to view source code for any ruby method from the console into your source editor
Feb 14, 2013
Mike Clark from Pragmatic Studio has a great tip for viewing any ruby method’s source code straight from the console.
Just define this method:
def source_for(object, method) location = object.method(method).source_location `subl #{location[0]}:#{location[1]}` if location location end
and then use it like so:
>> source_for(Person.new, :update)
Link: [The Pragmatic Studio | “View Source” On Ruby Methods]1 via pragmaticstudio.com |