class Object

Public Instance Methods

blank?() click to toggle source

An object is blank if it's false, empty, or a whitespace string. For example, “”, “ ”, nil, [], and {} are all blank.

This simplifies:

if address.nil? || address.empty?

…to:

if address.blank?
# File lib/core_ext/blank.rb, line 14
def blank?
  respond_to?(:empty?) ? empty? : !self
end