Sha256: 6700cb9a1aa3c5447d22636a8c58a1844d4cfd5b41402b82bed084e59c2843a1

Contents?: true

Size: 482 Bytes

Versions: 27

Compression:

Stored size: 482 Bytes

Contents

unless String.method_defined? :blank?
  class String
    # 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

27 entries across 24 versions & 6 rubygems

Version Path
powerpack-0.1.3 lib/powerpack/string/blank.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/blank.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/blank.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/blank.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/blank.rb
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/blank.rb
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/powerpack-0.1.2/lib/powerpack/string/blank.rb
powerpack-0.1.2 lib/powerpack/string/blank.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/powerpack-0.1.1/lib/powerpack/string/blank.rb
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/powerpack-0.0.9/lib/powerpack/string/blank.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/powerpack-0.0.9/lib/powerpack/string/blank.rb
powerpack-0.1.1 lib/powerpack/string/blank.rb