Support float in variable range

This commit is contained in:
Peter Zhu
2020-11-13 09:29:09 -05:00
parent eab12e1240
commit 76dbb0d640
2 changed files with 2 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ module Liquid
case input
when Integer
input
when NilClass, String
when NilClass, String, Float
input.to_i
else
Utils.to_integer(input)

View File

@@ -50,6 +50,7 @@ HERE
def test_for_with_variable_range
assert_template_result(' 1 2 3 ', '{%for item in (1..foobar) %} {{item}} {%endfor%}', "foobar" => 3)
assert_template_result(' 1 2 3 ', '{%for item in (x..y) %} {{item}} {%endfor%}', "x" => 1.1, "y" => 3.3)
end
def test_for_with_hash_value_range