Remove Modules

Hi,
How is it possible to remove modules from memory
In some files I have something like:
module MyModule
  module A
  end
end

and in some point I want to delete that module to be not available in
other files

···

--
Posted via http://www.ruby-forum.com/.

Hi,

You can use the (private) method Module#remove_const. However, this will
not delete the actual module but only the specific constant.

···

--
Posted via http://www.ruby-forum.com/.

Why? That seems like a design smell to me.

···

On May 22, 2012, at 05:26 , Mario Ruiz wrote:

How is it possible to remove modules from memory
In some files I have something like:

module MyModule
module A
end
end

and in some point I want to delete that module to be not available in
other files

This is exactly what I wanted

Thanks!!

Object.send(:remove_const, :MyModule)

···

--
Posted via http://www.ruby-forum.com/.