Class: Twig::Node::Expression::Parent

Inherits:
Expression::Base
  • Object
show all
Defined in:
lib/twig/node/expression/parent.rb

Overview

Represents a parent node

Instance Method Summary collapse

Constructor Details

#initialize(name, lineno) ⇒ Parent

Returns a new instance of Parent.

Parameters:

  • name (String)
  • lineno (Integer)


10
11
12
# File 'lib/twig/node/expression/parent.rb', line 10

def initialize(name, lineno)
  super({}, { output: false, name: }, lineno)
end

Instance Method Details

#compile(compiler) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/twig/node/expression/parent.rb', line 14

def compile(compiler)
  if attributes[:output]
    compiler.add_debug_info(self)
    raise NotImplementedError
  else
    compiler.
      raw('render_parent_block(').
      string(attributes[:name]).
      raw(', context, blocks)')
  end
end