Specifically regarding your question: "Also Class
inherits from Class
and Module
but why does my Taco
class ancestor's chain not inherit from them and instead inherits directly from Object
forward?"
Taco
is an instance of Class
, but its superclass is Object
. An instance relationship and a superclass relationship are 2 completely different things.
For example: imagine you create a class Animal
with a subclass Dog
. Animal.new
will give you an object which is an instance of Animal
. The Dog
class is not an instance of Animal
(it is not itself an animal -- rather, it defines a type of animal). Its superclass is Animal
.
Every object is an instance of some class -- call class
to find out which one. But not all objects have a superclass -- only instances of Class
do.
Additionally, Class
does not inherit from Class
. That is impossible. All classes appear at the beginning of their own ancestors
, but that doesn't mean they inherit from themselves. That is just how the ancestors
method works.