Class: Twig::Node::Expression::Binary::StartsWith
- Inherits:
-
Binary::Base
- Object
- Binary::Base
- Twig::Node::Expression::Binary::StartsWith
- Defined in:
- lib/twig/node/expression/binary/starts_with.rb
Instance Method Summary collapse
Instance Method Details
#compile(compiler) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/twig/node/expression/binary/starts_with.rb', line 8 def compile(compiler) left = compiler.var_name right = compiler.var_name compiler. raw("(#{left} = "). subcompile(nodes[:left]). raw(').respond_to?(:start_with?) && '). raw("(#{right} = "). subcompile(nodes[:right]). raw(").respond_to?(:start_with?) && (#{left}.start_with?(#{right}))") end |