Class: Twig::Node::Expression::Constant
- Includes:
- SupportDefinedTest
- Defined in:
- lib/twig/node/expression/constant.rb
Instance Attribute Summary
Attributes inherited from Base
#attributes, #lineno, #nodes, #source_context, #tag
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
-
#initialize(value, lineno) ⇒ Constant
constructor
A new instance of Constant.
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(value, lineno) ⇒ Constant
Returns a new instance of Constant.
9 10 11 |
# File 'lib/twig/node/expression/constant.rb', line 9 def initialize(value, lineno) super({}, { value: }, lineno) end |
Instance Method Details
#compile(compiler) ⇒ Object
13 14 15 |
# File 'lib/twig/node/expression/constant.rb', line 13 def compile(compiler) compiler.repr(define_test_enabled? || attributes[:value]) end |