nilclass
NilClass is a built-in class in Ruby that represents the absence of a value. The language provides a single instance of this class, nil, which is the only object of type NilClass. Consequently, nil.class evaluates to NilClass and nil.is_a?(NilClass) returns true. In Ruby, nil, along with false, is considered false in boolean contexts; all other objects are truthy.
NilClass defines a small, practical set of methods to support common operations. The nil? method returns true,
As a sentinel for “no value,” nil is frequently used in comparisons and conditionals. nil == nil evaluates
NilClass is part of Ruby’s core library and plays a central role in representing the absence of