Class: Twig::Node::Block
Instance Attribute Summary
Attributes inherited from Base
#attributes, #lineno, #nodes, #source_context, #tag
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
-
#initialize(name, body, lineno) ⇒ Block
constructor
A new instance of Block.
Methods inherited from Base
Constructor Details
#initialize(name, body, lineno) ⇒ Block
Returns a new instance of Block.
6 7 8 |
# File 'lib/twig/node/block.rb', line 6 def initialize(name, body, lineno) super({ body: }, { name: }, lineno) end |
Instance Method Details
#compile(compiler) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/twig/node/block.rb', line 10 def compile(compiler) compiler. write("def block_#{attributes[:name]}(context, blocks)\n"). indent. subcompile(nodes[:body]). outdent. write("end\n\n") end |