lib/core_ext/string.rb
# from activesupport/lib/active_support/core_ext/object/blank.rb
class String
BLANK_REGEX = /\A[[:space:]]*\z/
# A string is blank if it's empty or contains whitespaces only:
#
# ''.blank? # => true
# ' '.blank? # => true
# "\t\n\r".blank? # => true
# ' blah '.blank? # => false
#
# Unicode whitespace is supported:
#
# "\u00a0".blank? # => true
#
# @return [true, false]
def blank?
BLANK_REGEX === self
end
end