Kernel
The Kernel module is included by class Object, so its methods are available in every Ruby object. One of the reasons for the Kernel module is to allow methods like puts and gets to be available everywhere and even to look like global commands. Kernel methods allow Ruby to still maintain an “everything is an object” semantics. Kernel methods actually use the implicit receivers and could be written as self.puts and self.gets. As a result, Kernel methods are both available everywhere and resolve like any other method.
Since Kernel is mixed into Object, there is no practical difference between a method defined in Kernel and a method defined in Object. Logically, the distinction is that the methods in Object manage the object-oriented semantics ...
Get Programming Ruby 3.3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.