Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class · Ruby 4.1

NilClass

< Object 15 instance methods

The class of the singleton object nil.

Several of its methods act as operators:

Others act as converters, carrying the concept of nullity to other classes:

While nil doesn’t have an explicitly defined to_hash method, it can be used in ** unpacking, not adding any keyword arguments.

Another method provides inspection:

Finally, there is this query method:

Instance methods 15