Sha256: b9cb7524b10052f01de87b28aa702769afa68886d21da753d4a342507df27386

Contents?: true

Size: 541 Bytes

Versions: 8

Compression:

Stored size: 541 Bytes

Contents

# stolen from ActiveSupport

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
  def blank?
    self !~ /[^[:space:]]/
  end
end

class Numeric
  def blank?
    false
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
projectlocker_pulse-1.0.0 lib/pulse/utils/blank.rb
projectlocker_pulse-0.2.1 lib/pulse/utils/blank.rb
projectlocker_errata-0.1.1 lib/projectlocker_errata/utils/blank.rb
projectlocker_errata-0.1.0 lib/projectlocker_errata/utils/blank.rb
airbrake-3.1.5 lib/airbrake/utils/blank.rb
projectlocker_errata-0.0.2 lib/projectlocker_errata/utils/blank.rb
projectlocker_errata-0.0.1 lib/projectlocker_errata/utils/blank.rb
airbrake-3.1.4 lib/airbrake/utils/blank.rb