ReverseEng an Object's methods?

M

Mark T

Could there (ever) be a way to reverse engineer, (to code), an object's methods?
In the case where the object/module has been extended?
Is this more possible with 1.9.n?

MarkT
 
R

Ryan Davis

Could there (ever) be a way to reverse engineer, (to code), an = object's methods?
In the case where the object/module has been extended?
Is this more possible with 1.9.n?

You can use ParseTree and ruby2ruby in 1.8 (only).
 
R

Roger Pack

Mark said:
Could there (ever) be a way to reverse engineer, (to code), an object's
methods?
In the case where the object/module has been extended?
Is this more possible with 1.9.n?

Actually less possible since 1.9 doesn't keep around the parse tree's,
but still quite do-able.

ex (ri_for gem):

go.rb:

class A
def go
33
end
end
require 'rubygems'
require 'ri_for'
A.ri_for :go

$ gem install ri_for
$ ruby go.rb

C:\dev\ruby\scene-skipper>ruby go.rb
at go.rb:2
sig: A#go arity 0
def go
33
end
Original code signature: def go
#parameters signature: go( [] )

Enjoy.
-r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top