mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
revises comment for blank? method
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
class Object
|
||||
# An object is blank if it's false, empty, or a whitespace string.
|
||||
# For example, "", " ", +nil+, [], and {} are blank.
|
||||
# For example, "", " ", +nil+, [], and {} are all blank.
|
||||
#
|
||||
# This simplifies:
|
||||
#
|
||||
# if !address.nil? && !address.empty?
|
||||
# if address.nil? || address.empty?
|
||||
#
|
||||
# ...to:
|
||||
#
|
||||
# if !address.blank?
|
||||
# if address.blank?
|
||||
def blank?
|
||||
respond_to?(:empty?) ? empty? : !self
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user