lib/decanter/parser/float_parser.rb in decanter-1.1.10 vs lib/decanter/parser/float_parser.rb in decanter-2.1.0
- old
+ new
@@ -1,13 +1,13 @@
+# frozen_string_literal: true
+
module Decanter
module Parser
class FloatParser < ValueParser
- REGEX = /(\d|[.])/
+ allow Float
- allow Float, Integer
-
- parser do |val, options|
- val.scan(REGEX).join.try(:to_f)
+ parser do |val, _options|
+ Float(val)
end
end
end
end