There are so many methods in Object and Module that return arrays of
method names that it can be a bit confusing. Here’s a summary of my
current understanding. Is any of this wrong?
“instance_methods” is a method from Module.
Pass it true to include inherited methods (the default) and false to
To get the names of public instance methods in the class Foo, use
“methods” is a method from Object.
Pass it true to get instance methods (the default) and false to get
A singleton method on a Ruby Class is essentially like a static method
To get the names of public class methods in the class Foo, use
Foo.methods(false) == Foo.singleton_methods(false)
Why doesn’t Foo.methods(true) return the same thing as
I can see using a boolean parameter to tell whether you want inherited
methods to be included (as in the instance_methods method). However,
using a boolean parameter to tell whether you want instance or
singleton methods (as in the method “methods”) seems bad. Maybe that
should be deprecated in favor of instance_methods and