From: Rick DeNatale Date: 2009-09-23T05:09:47+09:00 Subject: Re: remove_const vs. Object.remove_const vs. Object.instance_eval { remove_const } On Tue, Sep 22, 2009 at 3:30 PM, jko170 wrote: > In order to remove a class, I have to use Object.instance_eval > { remove_const } > > Why couldn't I just use remove_const or Object.remove_const ? Module#remove_const is private. remove_const :Foo is sent to the top-level object which is not a module. Object.remove_const :Foo fails because the method is private. Object.instance_eval {remove_const :Foo} is one way of getting around the privacy, another would be Object.send(:remove_const :Foo} HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale