Class: String

Inherits:
Object show all
Defined in:
lib/burr/core_ext/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
' '.blank?               # => true
' something here '.blank? # => false

Returns:

  • (Boolean)


94
95
96
# File 'lib/burr/core_ext/blank.rb', line 94

def blank?
  self !~ /[^[:space:]]/
end