123456789_123456789_123456789_123456789_123456789_

Class: String

Relationships & Source Files
Inherits: Object
Defined in: lib/rubocop/core_ext/string.rb

Overview

Extensions to the core String class

Instance Attribute Summary

Instance Attribute Details

#blank?Boolean (readonly)

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

[ GitHub ]

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

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