Reputation: 701
The method methods
returns a list of all methods of a class, for example if I call 'miguel'.methods
, I will get a list of all the methods in the class String
.
I would like to list the methods of a class, excluding the methods of its superclasses. For example, a list of instance methods that are defined on String
, including modules included into String
.
I also would like to know how to list instance methods that are exclusively defined on the object class without listing instance methods included in modules included by the class.
Upvotes: 0
Views: 141
Reputation: 1879
Try this:
class.instance_methods(false)
Here for string as example:
'miguel'.class.instance_methods(false)
Upvotes: 1