Changing to keep default_proc support

This commit is contained in:
Mike Angell
2019-08-30 09:55:49 +10:00
parent 6590815b00
commit c06a325b3b
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ module Liquid
# This was changed from find() to find_index() because this is a very hot
# path and find_index() is optimized in MRI to reduce object allocation
scope = (index = @scopes.find_index { |s| s.key?(key) }) && @scopes[index]
scope ||= (index = @environments.find_index { |s| s.key?(key) }) && @environments[index]
scope ||= (index = @environments.find_index { |s| s.key?(key) || !s.default_proc.nil? }) && @environments[index]
scope ||= {}
variable = lookup_and_evaluate(scope, key, raise_on_not_found: raise_on_not_found).to_liquid