Ruby Language Introspection of class


Example

Lets following are the class definition

class A
   def a; end
end

module B
   def b; end
end

class C < A
   include B
   def c; end
end

What are the instance methods of C?

C.instance_methods # [:c, :b, :a, :to_json, :instance_of?...]

What are the instance methods that declare only on C?

C.instance_methods(false) # [:c]

What are the ancestors of class C?

C.ancestors # [C, B, A, Object,...]

Superclass of C?

C.superclass # A