Class: Twig::Node::Capture
Instance Attribute Summary
Attributes inherited from Base
#attributes, #lineno, #nodes, #source_context, #tag
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
-
#initialize(body, lineno) ⇒ Capture
constructor
A new instance of Capture.
Methods inherited from Base
#empty?, #length, #template_name, #to_s
Constructor Details
#initialize(body, lineno) ⇒ Capture
Returns a new instance of Capture.
8 9 10 |
# File 'lib/twig/node/capture.rb', line 8 def initialize(body, lineno) super({ body: }, { raw: false }, lineno) end |
Instance Method Details
#compile(compiler) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/twig/node/capture.rb', line 12 def compile(compiler) compiler. raw("context.buffer_and_return do\n"). indent. subcompile(nodes[:body]). outdent. write("end.to_s.html_safe\n") end |