R
Remi Gillig
Hello,
I just seached about this problem and found two 2 years old threads :
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/875a099efd08f70d
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/3e6fa1a935e50697
Each of these talk about how to reset the whole Ruby state, like
starting from a clean interpreter but without rerunning it. More or
less like emptying everything and putting back the predefined
constants, modules and classes.
The first thread has a solution which is using remove_const to not be
able to create classes anymore but this actually does not work
properly because you can still do this :
# class Hello end
# $hello = Hello
# Object.instance_eval("remove_const :Hello")
# h = $hello.new
I'm quite surprised that there was nothing about this in over 2 years
of development. Maybe there are some explanation inside the Ruby
Hacking Guide but most of it is in Japanese.
Anybody has any idea on how to implement this? Thanks.
Remi Gillig.
I just seached about this problem and found two 2 years old threads :
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/875a099efd08f70d
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/3e6fa1a935e50697
Each of these talk about how to reset the whole Ruby state, like
starting from a clean interpreter but without rerunning it. More or
less like emptying everything and putting back the predefined
constants, modules and classes.
The first thread has a solution which is using remove_const to not be
able to create classes anymore but this actually does not work
properly because you can still do this :
# class Hello end
# $hello = Hello
# Object.instance_eval("remove_const :Hello")
# h = $hello.new
I'm quite surprised that there was nothing about this in over 2 years
of development. Maybe there are some explanation inside the Ruby
Hacking Guide but most of it is in Japanese.
Anybody has any idea on how to implement this? Thanks.
Remi Gillig.