> For the complete documentation index, see [llms.txt](https://ploegert.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ploegert.gitbook.io/til/programmy/ruby/who-are-my-ancestors.md).

# Who Are My Ancestors?

Ruby's `Module` class provides the [`#ancestors`](http://ruby-doc.org/core-2.1.0/Module.html#method-i-ancestors) method. This method allows you to determine the ancestors (parents, grandparents, etc.) of a given class.

```ruby
> 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]
```
