I understand that every class in ruby is an instance of the Class class. Even for the Object class, Kernel.
However, I cannot wrap my head around the fact that the Object class, which is the ancestor of the Class class, can be an instance of the Class class, which is a subclass.
irb(main):018:0* Class.ancestors
=> [Class, Module, Object, Kernel, BasicObject]
irb(main):019:0> Object.ancestors
=> [Object, Kernel, BasicObject]
irb(main):020:0> Object.class
=> Class
source
share