Fix to_number filter for negative float strings

This commit is contained in:
Florian Weingarten
2016-03-31 09:18:55 -04:00
parent b3dda384c9
commit 1597f8859f
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ module Liquid
when Numeric
obj
when String
(obj.strip =~ /\A\d+\.\d+\z/) ? BigDecimal.new(obj) : obj.to_i
(obj.strip =~ /\A-?\d+\.\d+\z/) ? BigDecimal.new(obj) : obj.to_i
else
if obj.respond_to?(:to_number)
obj.to_number