Last updated 3 years ago
Was this helpful?
Ruby's Module class provides the method. This method allows you to determine the ancestors (parents, grandparents, etc.) of a given class.
Module
> 5.class.ancestors => [Fixnum, Integer, Numeric, Comparable, Object, PP::ObjectMixin, Kernel, BasicObject] > Array.ancestors => [Array, Enumerable, Object, PP::ObjectMixin, Kernel, BasicObject] > Class.ancestors => [Class, Module, Object, PP::ObjectMixin, Kernel, BasicObject] > BasicObject.ancestors => [BasicObject]
#ancestors