From: James Edward Gray II Date: 2007-07-24T23:45:56+09:00 Subject: Re: Inherited & load On Jul 24, 2007, at 9:40 AM, F. Senault wrote: > Le 24 juillet � 15:18, James Edward Gray II a �crit : > >> On Jul 24, 2007, at 5:10 AM, F. Senault wrote: >> >>> I can find the constant in Object.constants, but there is >>> no delete_const in there. :| >> >> $ ri -T remove_const >> Hope that helps. > > Alas, Object is not a module : Did you ask it? ;) >> Object.is_a? Module => true >> Object.class => Class >> Object.class.ancestors => [Class, Module, Object, Wirble::Shortcuts, PP::ObjectMixin, Kernel] > 16:35 fred@balvenie:~/ruby/espions> irb >>> o = Object.constants > => ["SocketError", ...] >>> class Test ; end > => nil >>> Object.constants - o > => ["Test"] >>> Object.remove_const(:Test) > NoMethodError: private method `remove_const' called for Object:Class > from (irb):4 >> Object.constants.grep("Test") => [] >> class Test; end => nil >> Object.constants.grep("Test") => ["Test"] >> Object.send(:remove_const, "Test") => Test >> Object.constants.grep("Test") => [] Hope that helps. James Edward Gray II