Class: Twig::Node::Expression::BlockReference
- Includes:
- SupportDefinedTest
- Defined in:
- lib/twig/node/expression/block_reference.rb
Overview
Represents a block reference node
Instance Attribute Summary
Attributes inherited from Base
#attributes, #lineno, #nodes, #source_context, #tag
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
-
#initialize(name, template, lineno) ⇒ BlockReference
constructor
A new instance of BlockReference.
Methods included from SupportDefinedTest
#define_test_enabled?, #enable_defined_test
Methods inherited from Base
#explicit_parentheses?, #set_explicit_parentheses
Methods inherited from Base
#empty?, #length, #template_name, #to_s
Constructor Details
#initialize(name, template, lineno) ⇒ BlockReference
Returns a new instance of BlockReference.
13 14 15 16 17 18 |
# File 'lib/twig/node/expression/block_reference.rb', line 13 def initialize(name, template, lineno) nodes = { name: } nodes[:template] = template unless template.nil? super(nodes, { output: false }, lineno) end |
Instance Method Details
#compile(compiler) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/twig/node/expression/block_reference.rb', line 20 def compile(compiler) if define_test_enabled? compile_template_call(compiler, 'block?') else compile_template_call(compiler, 'render_block') end end |