Ruby Module
has a method instance_methods
that can return a list of methods of that class. But how to retrieve class methods list of a class?
You can pass the false
parameter to Object#methods.
class Foo
def self.bar
end
end
Foo.methods(false) #=> [:bar]
Go to rails console with the command:
rails c
type:
Class.methods
and you will get them all in a list.
If you want to get a specific class' method, then type:
Class_name.methods
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With