Sha256: d9805b3d2cf83792964b863ec4ba6faa16eec6b759b8c087a68d0f3ac4228aa5

Contents?: true

Size: 697 Bytes

Versions: 45

Compression:

Stored size: 697 Bytes

Contents

# The blank extension adds the blank? method to all objects (e.g. Object#blank?).
#
# To load the extension:
#
#   Sequel.extension :blank

class FalseClass
  # false is always blank
  def blank?
    true
  end
end

class Object
  # Objects are blank if they respond true to empty?
  def blank?
    respond_to?(:empty?) && empty?
  end
end

class NilClass
  # nil is always blank
  def blank?
    true
  end
end

class Numeric
  # Numerics are never blank (not even 0)
  def blank?
    false
  end
end

class String
  # Strings are blank if they are empty or include only whitespace
  def blank?
    strip.empty?
  end
end

class TrueClass
  # true is never blank
  def blank?
    false
  end
end

Version data entries

45 entries across 45 versions & 2 rubygems

Version Path
sequel-4.30.0 lib/sequel/extensions/blank.rb
sequel-4.29.0 lib/sequel/extensions/blank.rb
sequel-4.28.0 lib/sequel/extensions/blank.rb
sequel-4.27.0 lib/sequel/extensions/blank.rb
sequel-4.26.0 lib/sequel/extensions/blank.rb
sequel-4.25.0 lib/sequel/extensions/blank.rb
sequel-4.24.0 lib/sequel/extensions/blank.rb
sequel-4.23.0 lib/sequel/extensions/blank.rb
sequel-4.22.0 lib/sequel/extensions/blank.rb
sequel-4.21.0 lib/sequel/extensions/blank.rb
sequel-4.20.0 lib/sequel/extensions/blank.rb
sequel-4.19.0 lib/sequel/extensions/blank.rb
sequel-4.18.0 lib/sequel/extensions/blank.rb
sequel-4.17.0 lib/sequel/extensions/blank.rb
sequel-4.16.0 lib/sequel/extensions/blank.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/blank.rb
sequel-4.15.0 lib/sequel/extensions/blank.rb
sequel-4.14.0 lib/sequel/extensions/blank.rb
sequel-4.13.0 lib/sequel/extensions/blank.rb
sequel-4.12.0 lib/sequel/extensions/blank.rb