Introspection of a class

suggest change

Take this 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, :singleton_class, ...]

to_json appears in that list only after json is loaded. What are the instance methods defined 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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents