Remove support for contextualization

This commit is contained in:
Guilherme Carreiro
2026-05-08 10:11:21 +02:00
parent fd49bbafb5
commit bc7f1caa35
2 changed files with 22 additions and 0 deletions
+2
View File
@@ -31,6 +31,8 @@ module Liquid
@self_context.variable_defined?(key) @self_context.variable_defined?(key)
end end
def context=(_); end
def to_liquid def to_liquid
self self
end end
@@ -68,4 +68,24 @@ class SelfDropContextTest < Minitest::Test
assert_template_result('42', source) assert_template_result('42', source)
end end
def test_self_drop_context_writer_is_a_noop
context = Context.new
drop = SelfDrop.new(context)
assert(drop.respond_to?(:context=))
drop.context = Context.new
assert_nil(drop.instance_variable_get(:@context))
end
def test_self_drop_with_strict_variables_does_not_raise_for_defined_var
t = Template.parse('{{ self.x }}')
result = t.render({ 'x' => 42 }, strict_variables: true)
assert_equal('42', result)
end
def test_self_drop_with_strict_variables_returns_nil_for_undefined_var
t = Template.parse('{{ self.x }}')
result = t.render({}, strict_variables: true)
assert_equal('', result)
end
end end