From: Adam Prescott Date: 2011-03-05T03:42:40+09:00 Subject: Re: Removing methods from an inherited class --e0cb4e6ffccb871292049dac7b69 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Mar 4, 2011 at 6:14 PM, I=C3=B1aki Baz Castillo wro= te: > Hi, if class A contains method "hello" and class B inherits from A, is > it possible to remove method "hello" in the definition of class B? > Maybe a workaround could be making "hello" method private in class B. > > NOTE: I do know that I can override "hello" method (something as "def > hello; nil; end") but I don't want it. > Are you looking to do this to make it use A#hello instead of B#hello ? If so, you might consider using `super`. That aside, you can look at Kernel#undef_method and Kernel#remove_method (the two have different semantics). http://ruby-doc.org/core/classes/Module.html#M000446 --e0cb4e6ffccb871292049dac7b69--