Sha256: ed9e91a55b51d44769f1864f6c54f42fa6017c8495a2dd787176b4d43464bbe3

Contents?: true

Size: 544 Bytes

Versions: 38

Compression:

Stored size: 544 Bytes

Contents

# frozen_string_literal: true

# Extensions to the core String class
class String
  unless method_defined? :blank?
    # Checks whether a string is blank. A string is considered blank if it
    # is either empty or contains only whitespace characters.
    #
    # @return [Boolean] true is the string is blank, false otherwise
    #
    # @example
    #   ''.blank? #=> true
    #
    # @example
    #   '    '.blank? #=> true
    #
    # @example
    #   '  test'.blank? #=> false
    def blank?
      empty? || strip.empty?
    end
  end
end

Version data entries

38 entries across 31 versions & 5 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.79.0/lib/rubocop/core_ext/string.rb
rubocop-0.89.1 lib/rubocop/core_ext/string.rb
rubocop-0.89.0 lib/rubocop/core_ext/string.rb
rubocop-0.88.0 lib/rubocop/core_ext/string.rb
rbhint-0.87.1.rc1 lib/rubocop/core_ext/string.rb
rubocop-0.87.1 lib/rubocop/core_ext/string.rb
rubocop-0.87.0 lib/rubocop/core_ext/string.rb
rubocop-0.86.0 lib/rubocop/core_ext/string.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/rubocop-0.85.1/lib/rubocop/core_ext/string.rb
rbhint-0.85.1.rc2 lib/rubocop/core_ext/string.rb
rbhint-0.85.1.rc1 lib/rubocop/core_ext/string.rb
rubocop-0.85.1 lib/rubocop/core_ext/string.rb
rbhint-0.8.5.rc1 lib/rubocop/core_ext/string.rb
rubocop-0.85.0 lib/rubocop/core_ext/string.rb
rubocop-0.84.0 lib/rubocop/core_ext/string.rb
rubocop-0.83.0 lib/rubocop/core_ext/string.rb
rubocop-0.82.0 lib/rubocop/core_ext/string.rb
rubocop-0.81.0 lib/rubocop/core_ext/string.rb
rubocop-0.80.1 lib/rubocop/core_ext/string.rb
rubocop-0.80.0 lib/rubocop/core_ext/string.rb