ReverseEng an Object's methods?

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

On Jul 23, 2010, at 16:48 , Mark T wrote:

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).

Mark T wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs