Documented String#blank?

This commit is contained in:
Sebastian Martinez
2011-04-17 19:47:46 -03:00
parent b14b058be8
commit d0635b6ad4

View File

@@ -85,7 +85,13 @@ class Hash
alias_method :blank?, :empty?
end
class String #:nodoc:
class String
# A string is blank if it's empty or contains whitespaces only
# For example:
#
# "".blank? => true
# " ".blank? => true
# " something here ".blank? => false
def blank?
self !~ /\S/
end