Sha256: 2159154f89bc679ceb64c156d999ad8f17176cf46e4495a9a098aef43031a63d

Contents?: true

Size: 837 Bytes

Versions: 36

Compression:

Stored size: 837 Bytes

Contents

# encoding: utf-8

unless "".respond_to?(:blank?)
  # blank? methods for several different class types
  class Object
    # Returns true if the object is nil or empty (if applicable)
    def blank?
      nil? || (respond_to?(:empty?) && empty?)
    end
  end # class Object

  class Numeric
    # Numerics can't be blank
    def blank?
      false
    end
  end # class Numeric

  class NilClass
    # Nils are always blank
    def blank?
      true
    end
  end # class NilClass

  class TrueClass
    # True is not blank.
    def blank?
      false
    end
  end # class TrueClass

  class FalseClass
    # False is always blank.
    def blank?
      true
    end
  end # class FalseClass

  class String
    # Strips out whitespace then tests if the string is empty.
    def blank?
      strip.empty?
    end
  end # class String
end

Version data entries

36 entries across 36 versions & 7 rubygems

Version Path
andrewtimberlake-carrierwave-0.3.2.1 lib/carrierwave/core_ext/blank.rb
durran-carrierwave-0.3.2.3 lib/carrierwave/core_ext/blank.rb
jnicklas-carrierwave-0.3.2.1 lib/carrierwave/core_ext/blank.rb
jnicklas-carrierwave-0.3.2 lib/carrierwave/core_ext/blank.rb
jnicklas-carrierwave-0.3.3 lib/carrierwave/core_ext/blank.rb
thorsson_carrierwave-0.4.12 lib/carrierwave/core_ext/blank.rb
thorsson_carrierwave-0.4.11 lib/carrierwave/core_ext/blank.rb
thorsson_carrierwave-0.4.10 lib/carrierwave/core_ext/blank.rb
thorsson_carrierwave-0.4.9 lib/carrierwave/core_ext/blank.rb
thorsson_carrierwave-0.4.8 lib/carrierwave/core_ext/blank.rb
thorsson_carrierwave-0.4.6 lib/carrierwave/core_ext/blank.rb
thorsson_carrierwave-0.4.5 lib/carrierwave/core_ext/blank.rb
carrierwave-0.4.10 lib/carrierwave/core_ext/blank.rb
carrierwave-0.4.9 lib/carrierwave/core_ext/blank.rb
carrierwave-0.4.8 lib/carrierwave/core_ext/blank.rb
carrierwave-0.4.7 lib/carrierwave/core_ext/blank.rb
carrierwave-0.4.6 lib/carrierwave/core_ext/blank.rb
samlown-carrierwave-0.4.5 lib/carrierwave/core_ext/blank.rb
dsturnbull-carrierwave-0.4.9 lib/carrierwave/core_ext/blank.rb
dsturnbull-carrierwave-0.4.8 lib/carrierwave/core_ext/blank.rb