Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Forked from clarkware/gist:1046693
Created June 25, 2011 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myronmarston/1046700 to your computer and use it in GitHub Desktop.
Save myronmarston/1046700 to your computer and use it in GitHub Desktop.
View Source for Ruby
# Toss this in your ~/.irbrc file for a convenient way
# to peruse Ruby source code in TextMate.
#
# Use in irb like so:
#
# >> require 'active_record'
# >> ActiveRecord::Base.source_for_method(:create)
class Object
def source_for_method(method)
location = self.method(method).source_location
`mate #{location[0]} -l #{location[1]}` if location
location
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment