Class: Liquid2::EchoTag

Inherits:
Tag show all
Defined in:
lib/liquid2/nodes/tags/echo.rb

Overview

The standard echo tag.

Instance Attribute Summary

Attributes inherited from Node

#blank, #token

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tag

#name

Methods inherited from Node

#block_scope, #children, #partial_scope, #render_with_disabled_tag_check, #template_scope

Constructor Details

#initialize(token, expression) ⇒ EchoTag

Returns a new instance of EchoTag.



19
20
21
22
23
# File 'lib/liquid2/nodes/tags/echo.rb', line 19

def initialize(token, expression)
  super(token)
  @expression = expression
  @blank = false
end

Class Method Details

.parse(token, parser) ⇒ EchoTag

Parameters:

Returns:



10
11
12
13
14
15
16
17
# File 'lib/liquid2/nodes/tags/echo.rb', line 10

def self.parse(token, parser)
  expression = unless %i[token_whitespace_control token_tag_end].include?(parser.current_kind)
                 parser.parse_filtered_expression
               end
  parser.carry_whitespace_control
  parser.eat(:token_tag_end)
  new(token, expression)
end

Instance Method Details

#expressionsObject



29
# File 'lib/liquid2/nodes/tags/echo.rb', line 29

def expressions = [@expression]

#render(context, buffer) ⇒ Object



25
26
27
# File 'lib/liquid2/nodes/tags/echo.rb', line 25

def render(context, buffer)
  buffer << Liquid2.to_output_s(context.evaluate(@expression))
end