class/method definitions, transactions and undo

  • Thread starter Marcin MielżyÅ„ski
  • Start date
M

Marcin Mielżyński

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
 

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

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top