2
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
user2012677
  • 5,465
  • 6
  • 51
  • 113

1 Answers1

4

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.

max pleaner
  • 26,189
  • 9
  • 66
  • 118