revises comment for blank? method

This commit is contained in:
Vijay Dev
2011-05-07 12:13:38 +05:30
parent 5e235278c4
commit 162bf8ffb1

View File

@@ -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