Class: Liquid2::Tag

Inherits:
Node
  • Object
show all
Defined in:
lib/liquid2/tag.rb

Overview

Base class for all Liquid tags.

Instance Attribute Summary

Attributes inherited from Node

#blank, #token

Instance Method Summary collapse

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

#nameObject



20
# File 'lib/liquid2/tag.rb', line 20

def name = @token[1] || raise

#render(_context, _buffer) ⇒ Object

Render this tag to the output buffer.

Parameters:



16
17
18
# File 'lib/liquid2/tag.rb', line 16

def render(_context, _buffer)
  raise "tags must implement `render: (RenderContext, String) -> void`."
end