Class: NilClass

Inherits:
Object show all
Defined in:
lib/reactive_support/core_ext/object/blank.rb

Overview

Ruby’s core NilClass (the singleton class consisting of the nil object). See documentation for version 2.1.3, 2.0.0, or 1.9.3.

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

nil is considered blank by definition; if #blank? is called on nil, it will always return true:

nil.blank?        # => true

# When the +foo+ variable is undefined or set to nil:
foo.blank?        # => true

Returns:

  • (Boolean)


124
125
126
# File 'lib/reactive_support/core_ext/object/blank.rb', line 124

def blank?
  true
end

#present?Boolean

Likewise, nil is not present by definition; if #present? is called on nil, it will always return false:

nil.present?      # => false

# When the +foo+ variable is undefined or set to nil:
foo.present?      # => false

Returns:

  • (Boolean)


135
136
137
# File 'lib/reactive_support/core_ext/object/blank.rb', line 135

def present?
  false
end