Skip to content
Tags

,

method definition location

August 25, 2011

Want to find the location of a method definition?

ruby-1.9.2-p290 :003 > Order.last.method(:bill_address_id=).source_location
 => ["/Users/gagan/.rvm/gems/ruby-1.9.2-p290/bundler/gems/spree_address_book-f261e916b432/app/models/order_decorator.rb", 19]

Or if the method is a class method do

> ActionView::Helpers::AssetTagHelper.method(:cache_asset_timestamps).source_location
 => ["/Users/gagan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.10/lib/active_support/core_ext/module/attribute_accessors.rb", 10] 
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: