Forum: Ruby class/method definitions, transactions and undo

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B97225f66bb5caac601b12735d430a0d?d=identicon&s=25 Marcin MielżyÅ?ski (Guest)
on 2006-02-15 23:39
(Received via mailing list)
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
This topic is locked and can not be replied to.