Class: Liquid2::Tag
Overview
Base class for all Liquid tags.
Direct Known Subclasses
AssignTag, BlockComment, BlockTag, BreakTag, CallTag, CaptureTag, CaseTag, ContinueTag, CycleTag, DecrementTag, DocTag, EchoTag, ExtendsTag, ForTag, IfTag, IncludeTag, IncrementTag, InlineComment, LiquidTag, MacroTag, RawTag, RenderTag, TableRowTag, WithTag
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(token) ⇒ Tag
constructor
A new instance of Tag.
- #name ⇒ Object
-
#render(_context, _buffer) ⇒ Object
Render this tag to the output buffer.
Methods inherited from Node
#block_scope, #children, #expressions, #partial_scope, #render_with_disabled_tag_check, #template_scope
Constructor Details
#initialize(token) ⇒ Tag
Returns a new instance of Tag.
6 7 8 9 10 11 |
# File 'lib/liquid2/tag.rb', line 6 def initialize(token) super return if token.first == :token_tag_name raise "unexpected token kind for tag #{self.class} (#{token})" end |
Instance Method Details
#name ⇒ Object
20 |
# File 'lib/liquid2/tag.rb', line 20 def name = @token[1] || raise |
#render(_context, _buffer) ⇒ Object
Render this tag to the output buffer.
16 17 18 |
# File 'lib/liquid2/tag.rb', line 16 def render(_context, _buffer) raise "tags must implement `render: (RenderContext, String) -> void`." end |