mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
+17
-3
@@ -27,6 +27,8 @@ module Liquid
|
|||||||
@parsed_variables = Hash.new{ |cache, markup| cache[markup] = variable_parse(markup) }
|
@parsed_variables = Hash.new{ |cache, markup| cache[markup] = variable_parse(markup) }
|
||||||
squash_instance_assigns_with_environments
|
squash_instance_assigns_with_environments
|
||||||
|
|
||||||
|
@this_stack_used = false
|
||||||
|
|
||||||
if rethrow_errors
|
if rethrow_errors
|
||||||
self.exception_handler = ->(e) { true }
|
self.exception_handler = ->(e) { true }
|
||||||
end
|
end
|
||||||
@@ -133,11 +135,19 @@ module Liquid
|
|||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# context['var] #=> nil
|
# context['var] #=> nil
|
||||||
def stack(new_scope={})
|
def stack(new_scope=nil)
|
||||||
push(new_scope)
|
old_stack_used = @this_stack_used
|
||||||
|
if new_scope
|
||||||
|
push(new_scope)
|
||||||
|
@this_stack_used = true
|
||||||
|
else
|
||||||
|
@this_stack_used = false
|
||||||
|
end
|
||||||
|
|
||||||
yield
|
yield
|
||||||
ensure
|
ensure
|
||||||
pop
|
pop if @this_stack_used
|
||||||
|
@this_stack_used = old_stack_used
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_instance_assigns
|
def clear_instance_assigns
|
||||||
@@ -146,6 +156,10 @@ module Liquid
|
|||||||
|
|
||||||
# Only allow String, Numeric, Hash, Array, Proc, Boolean or <tt>Liquid::Drop</tt>
|
# Only allow String, Numeric, Hash, Array, Proc, Boolean or <tt>Liquid::Drop</tt>
|
||||||
def []=(key, value)
|
def []=(key, value)
|
||||||
|
unless @this_stack_used
|
||||||
|
@this_stack_used = true
|
||||||
|
push({})
|
||||||
|
end
|
||||||
@scopes[0][key] = value
|
@scopes[0][key] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user