class String

def blank?

' something here '.blank? # => false
' '.blank? # => true
' '.blank? # => true
''.blank? # => true

A string is blank if it's empty or contains whitespaces only:
def blank?
  self !~ /[^[:space:]]/
end