Sha256: 02dd068b3cf39af9f5b46643fbd51179d19eddf91e2a5e1d0dbee5f58b7a00ab

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

class Object
  def blank?
    respond_to?(:empty?) ? !!empty? : !self
  end

  def present?
    !blank?
  end

  def presence
    self if present?
  end
end

class NilClass
  def blank?
    true
  end
end

class FalseClass
  def blank?
    true
  end
end

class TrueClass
  def blank?
    false
  end
end

class Array
  alias_method :blank?, :empty?
end

class Hash
  alias_method :blank?, :empty?
end

class String
  BLANK_RE = /\A[[:space:]]*\z/

  def blank?
    BLANK_RE === self
  end
end

class Numeric
  def blank?
    false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bright-2.0 lib/bright/helpers/blank_helper.rb