make the conditions around stack creation easier to read

This commit is contained in:
Tom Burns
2014-07-30 15:42:24 +00:00
parent 15f6cabf83
commit 794ca9f604

View File

@@ -137,8 +137,13 @@ module Liquid
# context['var] #=> nil
def stack(new_scope=nil)
old_stack_used = @this_stack_used
@this_stack_used = (new_scope != nil)
push(new_scope) if @this_stack_used
if new_scope
push(new_scope)
@this_stack_used = true
else
@this_stack_used = false
end
yield
ensure
pop if @this_stack_used