Class: Twig::Node::Block
- Inherits:
-
Node::Base
- Object
- Node::Base
- Twig::Node::Block
- Defined in:
- lib/twig/node/block.rb
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
-
#initialize(name, body, lineno) ⇒ Block
constructor
A new instance of Block.
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 18 19 |
# File 'lib/twig/node/block.rb', line 10 def compile(compiler) compiler. add_debug_info(self). write("def block_#{attributes[:name]}(context, blocks)\n"). indent. write("macros = @macros.dup\n"). subcompile(nodes[:body]). outdent. write("end\n\n") end |