instance method
blank?
Ruby on Rails 2.3.18
Since v2.2.3Signature
blank?()
An object is blank if it’s false, empty, or a whitespace string. For example, “”, “ ”, nil, [], and {} are blank.
This simplifies:
if !address.nil? && !address.empty?
…to:
if !address.blank?
Source
# File activesupport/lib/active_support/core_ext/object/blank.rb, line 12
def blank?
respond_to?(:empty?) ? empty? : !self
end
Defined in activesupport/lib/active_support/core_ext/object/blank.rb line 12
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object