Created
March 9, 2011 22:54
-
-
Save pjb3/863188 to your computer and use it in GitHub Desktop.
You can find at runtime where a method was defined. This is a little hack to then open that method in textmate
This file contains hidden or 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
> m = 2.days.method(:ago) | |
=> #<Method: Fixnum(ActiveSupport::CoreExtensions::Numeric::Time)#ago> | |
> m.__file__ | |
=> "/Users/paul/.rvm/gems/ree-1.8.7-2011.03@deals/gems/activesupport-2.3.5/lib/active_support/core_ext/numeric/time.rb" | |
> m.__line__ | |
=> 64 | |
> class Method; def open_in_textmate; `mate -l #{__line__} #{__file__}`; end; end | |
=> nil | |
> 2.days.method(:ago).open_in_textmate | |
=> "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment