Avoid hash with default values due to inconsistent marshalling

This commit is contained in:
Maxime Bedard
2017-09-19 16:23:14 -04:00
parent 27c91203ab
commit a796c17f8b
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -30,11 +30,11 @@ module Liquid
end
def render(context)
context.registers[:cycle] ||= Hash.new(0)
context.registers[:cycle] ||= Hash.new
context.stack do
key = context.evaluate(@name)
iteration = context.registers[:cycle][key]
iteration = context.registers[:cycle][key].to_i
result = context.evaluate(@variables[iteration])
iteration += 1
iteration = 0 if iteration >= @variables.size
+1 -1
View File
@@ -120,7 +120,7 @@ module Liquid
private
def collection_segment(context)
offsets = context.registers[:for] ||= Hash.new(0)
offsets = context.registers[:for] ||= Hash.new
from = if @from == :continue
offsets[@name].to_i