mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Allow template to be re-used without persisting assigns
This commit is contained in:
@@ -89,10 +89,11 @@ module Liquid
|
||||
when Liquid::Context
|
||||
args.shift
|
||||
when Hash
|
||||
self.assigns.merge!(args.shift)
|
||||
Context.new(assigns, registers, @rethrow_errors)
|
||||
a = args.shift
|
||||
assigns.each { |k,v| a[k] = v unless a.has_key?(k) }
|
||||
Context.new(a, registers, @rethrow_errors)
|
||||
when nil
|
||||
Context.new(assigns, registers, @rethrow_errors)
|
||||
Context.new(assigns.dup, registers, @rethrow_errors)
|
||||
else
|
||||
raise ArgumentError, "Expect Hash or Liquid::Context as parameter"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user