Skip to content

Commit f39e154

Browse files
charlespwdclaude
andcommitted
Force HybridTag subclasses to implement blank?
A hardcoded `true` default masked missing implementations. Raising NotImplementedError ensures each subclass explicitly defines blank?. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3a938f5 commit f39e154

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

lib/liquid/hybrid_tag.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def nodelist
2222
end
2323

2424
def blank?
25-
true
25+
raise NotImplementedError, "#{self.class} must implement blank?"
2626
end
2727

2828
def render_to_output_buffer(context, output)

test/unit/hybrid_tag_unit_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ class HybridTagUnitTest < Minitest::Test
66
include Liquid
77

88
class TestHybridTag < Liquid::HybridTag
9+
def blank?
10+
true
11+
end
12+
913
private
1014

1115
def render_self_closing_to_output_buffer(_context, output)

0 commit comments

Comments
 (0)