getsource - Get the source file path of the implementation of a given method =

This package cointains getsource, a extension which allows get the path name for the source of a method

Installation

gem install getsource

Usage

Basic Example

source1.rb

class X def foo end end

source2.rb

class Y < X def foo end end

main.rb

require “rallhook” require “source1.rb” require “source2.rb”

x = X.new y = Y.new

print x.method(:foo).body.file,“n” # source1.rb print y.method(:foo).body.file,“n” # source2.rb

print y.method(X,:foo).body.file,“n” # source1.rb print y.method(Y,:foo).body.file,“n” # source2.rb

NOTE: See examples directory of the gem installation

Copying

Copyright © 2010 Dario Seminara, released under the GPL License (see LICENSE)