diff --git a/lib/liquid/range_lookup.rb b/lib/liquid/range_lookup.rb index 57bccd0..8cf6da1 100644 --- a/lib/liquid/range_lookup.rb +++ b/lib/liquid/range_lookup.rb @@ -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) diff --git a/test/integration/tags/for_tag_test.rb b/test/integration/tags/for_tag_test.rb index f19d630..7c64087 100644 --- a/test/integration/tags/for_tag_test.rb +++ b/test/integration/tags/for_tag_test.rb @@ -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