mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
make the conditions around stack creation easier to read
This commit is contained in:
@@ -137,8 +137,13 @@ module Liquid
|
|||||||
# context['var] #=> nil
|
# context['var] #=> nil
|
||||||
def stack(new_scope=nil)
|
def stack(new_scope=nil)
|
||||||
old_stack_used = @this_stack_used
|
old_stack_used = @this_stack_used
|
||||||
@this_stack_used = (new_scope != nil)
|
if new_scope
|
||||||
push(new_scope) if @this_stack_used
|
push(new_scope)
|
||||||
|
@this_stack_used = true
|
||||||
|
else
|
||||||
|
@this_stack_used = false
|
||||||
|
end
|
||||||
|
|
||||||
yield
|
yield
|
||||||
ensure
|
ensure
|
||||||
pop if @this_stack_used
|
pop if @this_stack_used
|
||||||
|
|||||||
Reference in New Issue
Block a user