Class: Liquid2::Output

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

Overview

The AST node representing output statements.

Instance Attribute Summary collapse

Attributes inherited from Node

#blank, #token

Instance Method Summary collapse

Methods inherited from Node

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

Constructor Details

#initialize(token, expression) ⇒ Output

Returns a new instance of Output.

Parameters:

  • token ([Symbol, String?, Integer])
  • expression (Expression)


12
13
14
15
16
# File 'lib/liquid2/nodes/output.rb', line 12

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

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



8
9
10
# File 'lib/liquid2/nodes/output.rb', line 8

def expression
  @expression
end

Instance Method Details

#expressionsObject



22
# File 'lib/liquid2/nodes/output.rb', line 22

def expressions = [@expression]

#render(context, buffer) ⇒ Object



18
19
20
# File 'lib/liquid2/nodes/output.rb', line 18

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