Class: Twig::Node::Expression::MacroReference
- Inherits:
-
Expression::Base
- Object
- Expression::Base
- Twig::Node::Expression::MacroReference
- Includes:
- SupportDefinedTest
- Defined in:
- lib/twig/node/expression/macro_reference.rb
Overview
Represents a macro call node.
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
-
#initialize(template, name, arguments, lineno) ⇒ MacroReference
constructor
A new instance of MacroReference.
Methods included from SupportDefinedTest
#define_test_enabled?, #enable_defined_test
Constructor Details
#initialize(template, name, arguments, lineno) ⇒ MacroReference
Returns a new instance of MacroReference.
14 15 16 |
# File 'lib/twig/node/expression/macro_reference.rb', line 14 def initialize(template, name, arguments, lineno) super({ template:, arguments: }, { name: }, lineno) end |
Instance Method Details
#compile(compiler) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/twig/node/expression/macro_reference.rb', line 19 def compile(compiler) if define_test_enabled? compiler. subcompile(nodes[:template]). raw('.macro?('). repr(attributes[:name]). raw(', context'). raw(')') return end compiler. subcompile(nodes[:template]). raw('.render_macro('). repr(attributes[:name]). raw(', context, '). subcompile(nodes[:arguments]). raw(', '). repr(lineno). raw(', source_context)') end |