Merge pull request #932 from Shopify/avoid-default-values-hash

Avoid hash with default values due to inconsistent marshaling
This commit is contained in:
Maxime Bedard
2017-10-17 16:02:45 -04:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -30,11 +30,11 @@ module Liquid
end
def render(context)
context.registers[:cycle] ||= Hash.new(0)
context.registers[:cycle] ||= {}
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

View File

@@ -120,7 +120,7 @@ module Liquid
private
def collection_segment(context)
offsets = context.registers[:for] ||= Hash.new(0)
offsets = context.registers[:for] ||= {}
from = if @from == :continue
offsets[@name].to_i