From: Adriano Mitre Date: 2006-11-07T19:06:19+09:00 Subject: Re: how to reset and how to undefine a class > The first question is (a little) straightforward, once you get a > handle on how open Ruby's classes are. > To remove the 'stop' method, 'reopen' the class as you did when adding > 'stop' in the first place: > > class Song > undef stop > end I want to remove ("undef") all methods, no only a single one. That is what I meant with "reset a class". > Removing the whole 'Song' constant is a little weirder. There is a > remove_const method, but you have to call it on the thing that > contains the constant you want to remove. > In this case, the thing above Song is Object. > > Object.send(:remove_const, :Song) > > Sorry for my poor explanation. Hopefully you won't need to do this > very often. I never have. Heh. It is not exactly elegant, but indeed I think I won't need it often. I am inclined to using the "Object.send(:remove_const, :classname)" solution in both cases, reset and undef. Thank you very much. -- Posted via http://www.ruby-forum.com/.