class NilClass

Add blank? method to NilClass class.

Public Instance Methods

blank?() click to toggle source

Nil is always blank

@example

nil.blank?        # =>  true

@return [TrueClass]

@api public

# File lib/garcon/core_ext/nil.rb, line 30
def blank?
  true
end
clone?() click to toggle source
# File lib/garcon/core_ext/nil.rb, line 52
def clone? ; false ; end
dup!() click to toggle source

Since NilClass is immutable it cannot be duplicated. For this reason try_dup returns self.

nil.dup!  #=> nil
# File lib/garcon/core_ext/nil.rb, line 50
def dup!   ; self  ; end
dup?() click to toggle source
# File lib/garcon/core_ext/nil.rb, line 51
def dup?   ; false ; end
try(*args) click to toggle source

Calling ‘try` on `nil` always returns `nil`. It becomes especially helpful when navigating through associations that may return `nil`.

# File lib/garcon/core_ext/nil.rb, line 37
def try(*args)
  nil
end
try!(*args) click to toggle source
# File lib/garcon/core_ext/nil.rb, line 41
def try!(*args)
  nil
end