From e2450af4e6954e36af153ead88008ae6d7f383b7 Mon Sep 17 00:00:00 2001 From: Thierry Joyal Date: Thu, 3 Mar 2022 15:05:17 -0500 Subject: [PATCH] Add memoization comment --- lib/liquid/context.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/liquid/context.rb b/lib/liquid/context.rb index 270c902d..ffeb81a8 100644 --- a/lib/liquid/context.rb +++ b/lib/liquid/context.rb @@ -203,8 +203,14 @@ module Liquid value = contextualize(original) - # TODO: I'd like to fold this under the liquid sanitization + # TODO: This memoization layer knows about the Proc behaviour and it does not put me at ease + # Also to note: VariableLookup command flags do not know about it which might be ok + # # Original text from VariableLookup: if its a proc we will replace the entry with the proc + # + # Removing original.is_a?(Proc) from condition leads to: FrozenError: can't modify frozen Hash: {} + # Removing obj.respond_to?(:[]=) from condition leads to: Test suite passes + # obj[key] = value (no conditions): FrozenError + NoMethodError: undefined method `[]=' for if original.is_a?(Proc) && obj.respond_to?(:[]=) obj[key] = value end