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.79 lib/epitools/core_ext/truthiness.rb
epitools-0.5.78 lib/epitools/core_ext/truthiness.rb
epitools-0.5.77 lib/epitools/core_ext/truthiness.rb
epitools-0.5.75 lib/epitools/core_ext/truthiness.rb
epitools-0.5.74 lib/epitools/core_ext/truthiness.rb
epitools-0.5.73 lib/epitools/core_ext/truthiness.rb
epitools-0.5.72 lib/epitools/core_ext/truthiness.rb
epitools-0.5.71 lib/epitools/core_ext/truthiness.rb
epitools-0.5.70 lib/epitools/core_ext/truthiness.rb
epitools-0.5.69 lib/epitools/core_ext/truthiness.rb
epitools-0.5.68 lib/epitools/core_ext/truthiness.rb
epitools-0.5.67 lib/epitools/core_ext/truthiness.rb
epitools-0.5.66 lib/epitools/core_ext/truthiness.rb
epitools-0.5.65 lib/epitools/core_ext/truthiness.rb
epitools-0.5.64 lib/epitools/core_ext/truthiness.rb
epitools-0.5.63 lib/epitools/core_ext/truthiness.rb
epitools-0.5.61 lib/epitools/core_ext/truthiness.rb
epitools-0.5.60 lib/epitools/core_ext/truthiness.rb
epitools-0.5.59 lib/epitools/core_ext/truthiness.rb
epitools-0.5.58 lib/epitools/core_ext/truthiness.rb