I have the following in the file a.rb:
require foo
and i need to unload foo, to load the foo from b.rb, c.rb and other files.
How i can do?
I have the following in the file a.rb:
require foo
and i need to unload foo, to load the foo from b.rb, c.rb and other files.
How i can do?
Object.send(:remove_const, :Foo)
assuming your class is named Foo
.
I am not sure about the unloading part, but using load
instead of require
will always reload the file. However, when you use load you will need to include the .rb so in your case it would be load 'foo.rb'
.
See http://www.fromjavatoruby.com/2008/10/require-vs-load.html