instance method
blank?
Ruby on Rails 4.0.13
Since v2.2.3Signature
blank?()
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?
Source
# File activesupport/lib/active_support/core_ext/object/blank.rb, line 14
def blank?
respond_to?(:empty?) ? empty? : !self
end
Defined in activesupport/lib/active_support/core_ext/object/blank.rb line 14
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object