Class: Liquid2::Positive
- Inherits:
-
Expression
- Object
- Expression
- Liquid2::Positive
- Defined in:
- lib/liquid2/expressions/arithmetic.rb
Overview
Prefix positive
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
- #children ⇒ Object
- #evaluate(context) ⇒ Object
-
#initialize(token, right) ⇒ Positive
constructor
A new instance of Positive.
Methods inherited from Expression
Constructor Details
#initialize(token, right) ⇒ Positive
Returns a new instance of Positive.
106 107 108 109 |
# File 'lib/liquid2/expressions/arithmetic.rb', line 106 def initialize(token, right) super(token) @right = right end |
Instance Method Details
#children ⇒ Object
121 |
# File 'lib/liquid2/expressions/arithmetic.rb', line 121 def children = [@right] |
#evaluate(context) ⇒ Object
111 112 113 114 115 116 117 118 119 |
# File 'lib/liquid2/expressions/arithmetic.rb', line 111 def evaluate(context) right = context.evaluate(@right) value = Liquid2::Filters.to_decimal(right, default: nil) || context.env.undefined( "+(#{Liquid2.to_output_string(right)})", node: self ) value.send(:+@) end |