lib/facet/nilclass/to_f.rb in facets-0.9.0 vs lib/facet/nilclass/to_f.rb in facets-1.0.0
- old
+ new
@@ -1,31 +1,62 @@
-require 'nano/nilclass/to_f.rb'
\ No newline at end of file
+
+class NilClass
+
+ # Returns zero float, similar to #to_i.
+ #
+ # nil.to_f #=> 0.0
+ #
+ def to_f; 0.0; end
+
+end
+
+
+
+# _____ _
+# |_ _|__ ___| |_
+# | |/ _ \/ __| __|
+# | | __/\__ \ |_
+# |_|\___||___/\__|
+#
+=begin test
+
+ require 'test/unit'
+
+ class TCNilClass < Test::Unit::TestCase
+
+ def test_to_f
+ assert_equal( 0.0, nil.to_f )
+ end
+
+ end
+
+=end