Sha256: 898de31bc223940527ff26257fc97a99105ecd67537162614d7b0467449bb657

Contents?: true

Size: 561 Bytes

Versions: 6

Compression:

Stored size: 561 Bytes

Contents

# encoding: utf-8

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

6 entries across 6 versions & 1 rubygems

Version Path
bright-1.3 lib/bright/helpers/blank_helper.rb
bright-1.2.3 lib/bright/helpers/blank_helper.rb
bright-1.2.2 lib/bright/helpers/blank_helper.rb
bright-1.2.1 lib/bright/helpers/blank_helper.rb
bright-1.2 lib/bright/helpers/blank_helper.rb
bright-1.1 lib/bright/helpers/blank_helper.rb