How is the Kernel module an ancestor of Object?

inheritance chain:

Class -> Module -> Object

Kernel.is_a?(Module) # => true

Kernel is an instance of Module, which in turn inherits from Object.

So how is Kernel an ancestor of Object?

I found it on line 262 of “The Ruby P.ming Language”:

“The Kernel module is an ancestor of Object.”

It would be more correct to say that Object includes the Kernel module.
see http://ruby-doc.org/core-1.9.3/Object.html

Dheeraj K.

Dheeraj K. wrote in post #1077704:

It would be more correct to say that Object includes the Kernel module.
see http://ruby-doc.org/core-1.9.3/Object.html

When a class includes a module, ruby creates an anonymous class out of
the module and inserts into the inheritance chain directly above the
includer.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs