Sha256: cbd9a13f2e75a88638a291cf4995e06e34b58e2c45731d03f635045b35969ec5

Contents?: true

Size: 710 Bytes

Versions: 95

Compression:

Stored size: 710 Bytes

Contents

# 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

Version data entries

95 entries across 95 versions & 24 rubygems

Version Path
brianmario-couchrest-0.23 lib/couchrest/support/blank.rb
gbuesing-couchrest-0.23 lib/couchrest/support/blank.rb
glasner-couchrest-0.2.2 lib/couchrest/support/blank.rb
gohanlonllc-couchrest-0.2.3.1 lib/couchrest/support/blank.rb
halfninja-couchrest-0.23.2 lib/couchrest/support/blank.rb
halfninja-couchrest-0.23.3 lib/couchrest/support/blank.rb
jchris-couchrest-0.16 lib/couchrest/support/blank.rb
jchris-couchrest-0.17.0 lib/couchrest/support/blank.rb
jchris-couchrest-0.2.1 lib/couchrest/support/blank.rb
jchris-couchrest-0.2.2 lib/couchrest/support/blank.rb
jchris-couchrest-0.2 lib/couchrest/support/blank.rb
jchris-couchrest-0.22 lib/couchrest/support/blank.rb
jchris-couchrest-0.23 lib/couchrest/support/blank.rb
jkestr-couchrest-0.23 lib/couchrest/support/blank.rb
jpbougie-couchrest-0.27 lib/couchrest/support/blank.rb
jrun-couchrest-0.17.1 lib/couchrest/support/blank.rb
jrun-couchrest-0.2.1.1 lib/couchrest/support/blank.rb
jrun-couchrest-0.2.1 lib/couchrest/support/blank.rb
mattetti-couchrest-0.13.1 lib/couchrest/support/blank.rb
mattetti-couchrest-0.13.2 lib/couchrest/support/blank.rb