lib/polyfill/internal_utils.rb in polyfill-1.1.0 vs lib/polyfill/internal_utils.rb in polyfill-1.2.0
- old
+ new
@@ -106,7 +106,16 @@
end
obj.to_int
end
module_function :to_int
+
+ def to_f(obj)
+ unless obj.respond_to?(:to_f)
+ raise TypeError, "no implicit conversion of #{obj.class} into Float"
+ end
+
+ obj.to_f
+ end
+ module_function :to_f
end
end