Class/method definitions, transactions and undo

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