Reputation: 5735
class Foo
def initialize()
end
def cow
end
def dog
end
def any_other
end
end
What method can I use to find just my custom defined methods, cow, dog, and any_other, and not any of the base methods?
Foo.custom_methods
>>
:cow
:dog
:any_other
Upvotes: 2
Views: 79
Reputation: 26758
You can use Foo.instance_methods(false)
to get the instance methods, and Foo.methods(false)
to get the class methods.
The false
argument is saying dont show inherited methods.
Upvotes: 4