Method: String#blank?

Defined in:
lib/rubocop/core_ext/string.rb

#blank?Boolean

Checks whether a string is blank. A string is considered blank if it is either empty or contains only whitespace characters.

Examples:

''.blank? #=> true
'    '.blank? #=> true
'  test'.blank? #=> false

Returns:

  • (Boolean)

    true is the string is blank, false otherwise



19
20
21
# File 'lib/rubocop/core_ext/string.rb', line 19

def blank?
  empty? || lstrip.empty?
end