Sha256: 29f6bd362785d1c5ffbbf3a6a56ffe18216dc1c3b25639af89b322baa3a9f297

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

# partialy extracted from
# https://github.com/rails/rails/blob/5-0-stable/activesupport/lib/active_support/core_ext/object/blank.rb

class Object
  def blank?
    !self
  end

  def empty?
    blank?
  end

  def present?
    !blank?
  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
  def blank?
    self.length == 0
  end
end

class Hash
  def blank?
    self.keys.length == 0
  end
end

class Numeric
  def blank?
    false
  end
end

class Time
  def blank?
    false
  end
end

class String
  # gem 'fast_blank'
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lux-fw-0.1.35 ./lib/overload/blank.rb
lux-fw-0.1.17 ./lib/overload/blank.rb