Sha256: 8613bbfbc08bebbd7e952af2a211b9f9c4436455ed7c7bee98656728cf90676c

Contents?: true

Size: 224 Bytes

Versions: 13

Compression:

Stored size: 224 Bytes

Contents

class NilClass

  unless method_defined?(:to_f)

    # Allows <tt>nil</tt> to respond to #to_f.
    # Always returns <tt>0</tt>.
    #
    #   nil.to_f   #=> 0.0
    #
    # CREDIT: Matz

    def to_f; 0.0; end

  end

end

Version data entries

13 entries across 12 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/nilclass/to_f.rb
facets-2.9.2 lib/core/facets/nilclass/to_f.rb
facets-2.9.2 src/core/facets/nilclass/to_f.rb
facets-2.9.1 lib/core/facets/nilclass/to_f.rb
facets-2.9.0 lib/core/facets/nilclass/to_f.rb
facets-2.9.0.pre.2 lib/core/facets/nilclass/to_f.rb
facets-2.9.0.pre.1 lib/core/facets/nilclass/to_f.rb
facets-2.8.4 lib/core/facets/nilclass/to_f.rb
facets-2.8.3 lib/core/facets/nilclass/to_f.rb
facets-2.8.2 lib/core/facets/nilclass/to_f.rb
facets-2.8.1 lib/core/facets/nilclass/to_f.rb
facets-2.8.0 lib/core/facets/nilclass/to_f.rb
facets-2.7.0 lib/core/facets/nilclass/to_f.rb