Sha256: 67de1cba13692c250ec9108388feaf685dce05c001c6ba3c7e2ca799d906b26e

Contents?: true

Size: 560 Bytes

Versions: 253

Compression:

Stored size: 560 Bytes

Contents

# frozen_string_literal: true

# Extensions to the core String class
class String
  unless method_defined?(:blank?) && ' '.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? || lstrip.empty?
    end
  end
end

Version data entries

253 entries across 244 versions & 23 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/core_ext/string.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/core_ext/string.rb
rubocop-1.65.0 lib/rubocop/core_ext/string.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/core_ext/string.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/core_ext/string.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/core_ext/string.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rubocop-1.64.1/lib/rubocop/core_ext/string.rb
rubocop-1.64.1 lib/rubocop/core_ext/string.rb
rubocop-1.63.4 lib/rubocop/core_ext/string.rb
rubocop-1.63.3 lib/rubocop/core_ext/string.rb
rubocop-1.63.2 lib/rubocop/core_ext/string.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/core_ext/string.rb
rubocop-1.63.1 lib/rubocop/core_ext/string.rb
rubocop-1.63.0 lib/rubocop/core_ext/string.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.62.1/lib/rubocop/core_ext/string.rb
rubocop-1.62.1 lib/rubocop/core_ext/string.rb
rubocop-1.62.0 lib/rubocop/core_ext/string.rb
rubocop-1.61.0 lib/rubocop/core_ext/string.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.2/lib/rubocop/core_ext/string.rb
rubocop-1.60.2 lib/rubocop/core_ext/string.rb