Object

Object is the parent class of (almost) all classes in Ruby unless a class explicitly inherits from BasicObject. So, its methods are available to all objects unless explicitly overridden.

Object mixes in the Kernel module, making the built-in kernel functions globally accessible (see Kernel). The methods discussed here for the Object class mostly pertain to Ruby’s object-oriented semantics.

An interesting fact about Ruby’s actual implementation is that even these methods that are documented here (and in Ruby’s official documentation) as being part of Object are actually all internally defined in Kernel. You can prove this by calling owner on any Method object in Object, as in Object.instance_method(:itself).owner. The official documentation ...

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.