Class: Liquid2::LogicalOr
- Inherits:
-
Expression
- Object
- Expression
- Liquid2::LogicalOr
- Defined in:
- lib/liquid2/expressions/logical.rb
Overview
Logical disjunction.
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
- #children ⇒ Object
- #evaluate(context) ⇒ Object
-
#initialize(token, left, right) ⇒ LogicalOr
constructor
A new instance of LogicalOr.
Methods inherited from Expression
Constructor Details
#initialize(token, left, right) ⇒ LogicalOr
Returns a new instance of LogicalOr.
43 44 45 46 47 |
# File 'lib/liquid2/expressions/logical.rb', line 43 def initialize(token, left, right) super(token) @left = left @right = right end |
Instance Method Details
#children ⇒ Object
54 |
# File 'lib/liquid2/expressions/logical.rb', line 54 def children = [@left, @right] |
#evaluate(context) ⇒ Object
49 50 51 52 |
# File 'lib/liquid2/expressions/logical.rb', line 49 def evaluate(context) left = context.evaluate(@left) Liquid2.truthy?(context, left) ? left : context.evaluate(@right) end |