instance_methods(...)
public
Returns an array containing the names of public instance methods in the receiver. For
a module, these are the public methods;
for a class, they are the instance (not singleton) methods. With no
argument, or with an argument that is false, the instance methods
in mod are returned, otherwise the methods in mod and
mod’s superclasses are returned.
module A
def method1() end
end
class B
def method2() end
end
class C < B
def method3() end
end
A.instance_methods
B.instance_methods(false)
C.instance_methods(false)
C.instance_methods(true).length
Show source
/*
* call-seq:
* mod.instance_methods(include_super=true) => array
*
* Returns an array containing the names of public instance methods in
* the receiver. For a module, these are the public methods; for a
* class, they are the instance (not singleton) methods. With no
* argument, or with an argument that is <code>false</code>, the
* instance methods in <i>mod</i> are returned, otherwise the methods
* in <i>mod</i> and <i>mod</i>'s superclasses are returned.
*
* module A
* def method1() end
* end
* class B
* def method2() end
* end
* class C < B
* def method3() end
* end
*
* A.instance_methods #=> ["method1"]
* B.instance_methods(false) #=> ["method2"]
* C.instance_methods(false) #=> ["method3"]
* C.instance_methods(true).length #=> 43
*/
VALUE
rb_class_instance_methods(argc, argv, mod)
int argc;
VALUE *argv;
VALUE mod;
{
return class_instance_method_list(argc, argv, mod, ins_methods_i);
}