Class: Twig::Node::Expression::Binary::Base
- Inherits:
-
Twig::Node::Expression::Base
- Object
- Base
- Twig::Node::Expression::Base
- Twig::Node::Expression::Binary::Base
- Defined in:
- lib/twig/node/expression/binary/base.rb
Direct Known Subclasses
Boolean, Concat, Elvis, EndsWith, FloorDiv, HasEvery, HasSome, In, Matches, NotIn, NullCoalesce, StartsWith
Instance Attribute Summary
Attributes inherited from Base
#attributes, #lineno, #nodes, #source_context, #tag
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
-
#initialize(left, right, lineno) ⇒ Base
constructor
A new instance of Base.
- #operator(compiler) ⇒ Object
Methods inherited from Twig::Node::Expression::Base
#explicit_parentheses?, #set_explicit_parentheses
Methods inherited from Base
#empty?, #length, #template_name, #to_s
Constructor Details
#initialize(left, right, lineno) ⇒ Base
Returns a new instance of Base.
8 9 10 |
# File 'lib/twig/node/expression/binary/base.rb', line 8 def initialize(left, right, lineno) super({ left:, right: }, {}, lineno) end |
Instance Method Details
#compile(compiler) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/twig/node/expression/binary/base.rb', line 13 def compile(compiler) compiler. raw('('). subcompile(nodes[:left]). raw(' ') operator(compiler) compiler. raw(' '). subcompile(nodes[:right]). raw(')') end |
#operator(compiler) ⇒ Object
28 29 30 |
# File 'lib/twig/node/expression/binary/base.rb', line 28 def operator(compiler) raise 'operator is not implemented' end |