Class: String

Inherits:
Object show all
Includes:
Buff::Extensions::String::Inflections
Defined in:
lib/buff/extensions/object/blank.rb,
lib/buff/extensions/string/inflections.rb

Instance Method Summary collapse

Methods included from Buff::Extensions::String::Inflections

#underscore

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)

93
94
95
# File 'lib/buff/extensions/object/blank.rb', line 93

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