From: Zach Dennis Date: 2005-01-28T01:38:48+09:00 Subject: Re: Self and Ruby Comparisons Csaba Henk wrote: >> There is also : what do you do is someone write ? >> >> class C >> uninclude Kernel >> end > > > Is there any danger to let this? You can undef all methods one by one > now as well (leave "undef_method" for last :) ). If its problematic, > raise an error. > This is pulled from the documentation for undef_method: class Parent def hello puts "In parent" end end class Child < Parent def hello puts "In child" end end c = Child.new c.hello class Child remove_method :hello # remove from child, still in parent end c.hello class Child undef_method :hello # prevent any calls to 'hello' end c.hello How do you know if the user truly wants to block all calls to "hello", or if they are just trying to remove the "hello" method on the Child class? Perhaps it still should go up to the next "hello" method in the ancestor chain...but undef_method doesn't work like that. Zach