Sha256: 085ecada3ce0b8fc5803257667b0ffa940b8df8e36aaf12b430151b4716d4107

Contents?: true

Size: 606 Bytes

Versions: 72

Compression:

Stored size: 606 Bytes

Contents

class Object
  
  #
  # Default "integer?" behaviour.
  #
  def integer?; false; end
   
  #
  # `truthy?` means `not blank?`
  #
  def truthy?
    if respond_to? :blank?
      not blank?
    else
      not nil?
    end
  end
  
end


class TrueClass

  def truthy?; true; end

end


class FalseClass

  def truthy?; false; end

end


class Float

  #
  # 'true' if the float is 0.0
  #
  def blank?; self == 0.0; end

end


class NilClass

  #
  # Always 'true'; nil is considered blank.
  #
  def blank?; true; end

end


class Symbol

  #
  # Symbols are never blank.
  #
  def blank?; false; end

end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
epitools-0.5.33 lib/epitools/core_ext/truthiness.rb
epitools-0.5.32 lib/epitools/core_ext/truthiness.rb
epitools-0.5.31 lib/epitools/core_ext/truthiness.rb
epitools-0.5.30 lib/epitools/core_ext/truthiness.rb
epitools-0.5.29 lib/epitools/core_ext/truthiness.rb
epitools-0.5.28 lib/epitools/core_ext/truthiness.rb
epitools-0.5.27 lib/epitools/core_ext/truthiness.rb
epitools-0.5.26 lib/epitools/core_ext/truthiness.rb
epitools-0.5.25 lib/epitools/core_ext/truthiness.rb
epitools-0.5.24 lib/epitools/core_ext/truthiness.rb
epitools-0.5.23 lib/epitools/core_ext/truthiness.rb
epitools-0.5.22 lib/epitools/core_ext/truthiness.rb
epitools-0.5.21 lib/epitools/core_ext/truthiness.rb
epitools-0.5.20 lib/epitools/core_ext/truthiness.rb
epitools-0.5.19 lib/epitools/core_ext/truthiness.rb
epitools-0.5.18 lib/epitools/core_ext/truthiness.rb
epitools-0.5.17 lib/epitools/core_ext/truthiness.rb
epitools-0.5.16 lib/epitools/core_ext/truthiness.rb
epitools-0.5.15 lib/epitools/core_ext/truthiness.rb
epitools-0.5.14 lib/epitools/core_ext/truthiness.rb