News for hackers. Stuff that matters.
Re:Keep Ruby Weird Again [video] by inopinatus on Wednesday November 02, 2016 @04:15AM (#12852998)
re.2, to find where a function was defined, use source_location on the Method instance. e.g. I have this in a dev-specific initializer:

    class Method
      def subl
        system("subl", source_location.join(":"))
      end
    end
Now if "response.context" is throwing an exception, I can find its definition with

    response.method(:context).subl
Et voila, the source file is opened in Sublime Text and positioned at 'def context'. This even works for the nutty stuff, like methods defined dynamically in an eigenclass.

Also, pry & better_errors are your friends.

There are no comments on this comment yet.