Fix behaviour of Context#stack when Context#push raises.

We only want to pop the scope at the end of the method if pushing it
succeeded, so the push needs to be outside the block with the ensure.
This commit is contained in:
Mark H. Wilkinson
2011-04-12 14:24:26 +01:00
parent 7bbb4ff84f
commit aafb3ed9f2
+6 -3
View File
@@ -88,9 +88,12 @@ module Liquid
# context['var] #=> nil
def stack(new_scope={})
push(new_scope)
yield
ensure
pop
begin
yield
ensure
pop
end
end
def clear_instance_assigns