Merge pull request #735 from Shopify/fix-to-number-for-negative-float-strings

Fix to_number filter for negative float strings
This commit is contained in:
Florian Weingarten
2016-03-31 15:52:51 -04:00
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