← TIL

Get Object Instance Methods

You can quickly get the direct instance methods of an object by calling instance_methods on that object's class.

user.instance_of?(Person)
# => true

user.class.instance_methods(false)
# => [:speak, :walk, :sit]

Passing provided flag of false filters out methods from ancestors.