Class: Liquid2::Expression
- Inherits:
-
Object
- Object
- Liquid2::Expression
- Defined in:
- lib/liquid2/expression.rb
Overview
Base class for all expressions.
Direct Known Subclasses
ArithmeticExpression, ArrayLiteral, ArraySpread, Blank, BooleanExpression, ComparisonExpression, Empty, Filter, FilteredExpression, GroupedExpression, Identifier, KeywordArgument, Lambda, LogicalAnd, LogicalNot, LogicalOr, LoopExpression, Negative, ObjectLiteral, ObjectLiteralItem, Parameter, Path, Positive, RangeExpression, TemplateString, TernaryExpression
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#children ⇒ Object
Return children of this expression.
- #evaluate(_context) ⇒ Object
-
#initialize(token) ⇒ Expression
constructor
A new instance of Expression.
-
#scope ⇒ Object
Return variables this expression adds to the scope of any child expressions.
Constructor Details
#initialize(token) ⇒ Expression
Returns a new instance of Expression.
9 10 11 |
# File 'lib/liquid2/expression.rb', line 9 def initialize(token) @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
6 7 8 |
# File 'lib/liquid2/expression.rb', line 6 def token @token end |
Instance Method Details
#children ⇒ Object
Return children of this expression.
19 |
# File 'lib/liquid2/expression.rb', line 19 def children = [] |
#evaluate(_context) ⇒ Object
14 15 16 |
# File 'lib/liquid2/expression.rb', line 14 def evaluate(_context) raise "all expressions must implement `evaluate: (RenderContext context) -> untyped`" end |
#scope ⇒ Object
Return variables this expression adds to the scope of any child expressions. Currently used by lambda expressions only.
23 |
# File 'lib/liquid2/expression.rb', line 23 def scope = nil |