From: dblack@... Date: 2007-06-15T20:19:40+09:00 Subject: Re: class destruction (evil genius metaprogramming) Hi -- On Fri, 15 Jun 2007, Rick DeNatale wrote: > kermit.class.instance_methods(false).each{|m| > Muppet.instance_eval("remove_method #{m.inspect}")} > > Note 1. kermit.methods will return all methods inherited or not. > Note 2. remove method is a class method, so it's evaluated in the > context of the class object, hence Muppet.instance_eval > Note 3: you could alternatively pass symbols for the method names > > kermit.class.instance_methods(false).each{|m| > Muppet.instance_eval("remove_method :#{m}")} You can also just use the block form of instance_eval: Muppet.instance_eval { remove_method(m) } David -- * Books: RAILS ROUTING (new! http://safari.awprofessional.com/9780321509246) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)