Class: NilClass

Inherits:
Object show all
Defined in:
lib/more_ruby/nilclass.rb

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

A simple routing method in case your empty array is actually nil If you’re calling empty?, you care if there is data in there, not if the object is actually an array nil is obviously empty, so return true instead of NoMethodError

Returns:

  • (Boolean)


7
8
9
# File 'lib/more_ruby/nilclass.rb', line 7

def empty?
    true
end