to_float support for non String values

This commit is contained in:
Yorick Peterse committed 2015-08-19 20:14:22 +02:00
1 parent f3f3c7d31c
commit e3b45fddfc
2 files changed
+7 -5

No files matched your search

+1 -5
View File
@@ -63,11 +63,7 @@ module Oga
value = value.text
end
if value.is_a?(String)
value = Float(value) rescue Float::NAN
end
value
Float(value) rescue Float::NAN
end
# @return [TrueClass|FalseClass]