[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

class/method definitions, transactions and undo

Marcin Mielzynski

2/15/2006 10:36:00 PM

Hi
I wonder what would be the easiest way to create transactional/undoable
modifications to Ruby's method, classes, hierarchies...

I started with

class C
def C.method_added m
p C.instance_methods(false)
end
end

p C.instance_methods(false)

class C
def new_method

end
end

C.class_eval{
define_method :new_method2 do |*args|
end
}

->
[]
["new_method"]
["new_method2", "new_method"]



but it seems that method_added is called after methods additions, so
there is no way to alias and save it into an array to achieve some kind
of history...

any clues ?


lopex