lib/liquid/range_lookup.rb in liquid-3.0.6 vs lib/liquid/range_lookup.rb in liquid-4.0.0.rc1

- old
+ new

@@ -14,9 +14,24 @@ @start_obj = start_obj @end_obj = end_obj end def evaluate(context) - context.evaluate(@start_obj).to_i..context.evaluate(@end_obj).to_i + start_int = to_integer(context.evaluate(@start_obj)) + end_int = to_integer(context.evaluate(@end_obj)) + start_int..end_int + end + + private + + def to_integer(input) + case input + when Integer + input + when NilClass, String + input.to_i + else + Utils.to_integer(input) + end end end end