tario / getsource

Get the source file path of the implementation of a given method

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

= 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 (c) 2010 Dario Seminara, released under the GPL License (see LICENSE)

About

Get the source file path of the implementation of a given method

License:GNU General Public License v3.0


Languages

Language:Ruby 52.3%Language:C 47.7%