From: "Jesús Gabriel y Galán" Date: 2010-10-01T19:13:02+09:00 Subject: Re: How to prevent overwriting methods by accident? On Fri, Oct 1, 2010 at 12:00 PM, Brian Candler wrote: > Jesús Gabriel y Galán wrote: >> Shouldn't we be using respond_to? instead of method_defined? or >> methods.include?. > > respond_to? only works on instances of objects, not when you're within > the class. > > You could do "new.respond_to? ..." but if the initialize method needs > arguments, you'll have to provide them. Ah, you are right, I missed that we were not in an instance... Anyway, be careful then with this technique, cause if the instance would be handling that method call with method_missing you will not know it using the above. Regards, Jesus.