How do I check if a method is defined on some class directly, not by inheritance or by inclusion/extension? I want something like \'foo?\' in the following:
clas
For objects you can use Object.respond_to?.
Returns true if obj responds to the given method.
For classes take a look at Module.instance_methods
Returns an array containing the names of the public and protected instance methods in the receiver.