Class: String

Inherits:
Object show all
Defined in:
lib/core_ext/object/blank.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

A string is blank if it’s empty or contains whitespaces only:

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

Returns:

  • (Boolean)


98
99
100
# File 'lib/core_ext/object/blank.rb', line 98

def blank?
  self !~ /\S/
end