Module: Veritas::Optimizer::Function::Binary::ConstantOperands
- Included in:
- Connective::Binary::ConstantOperands, Numeric::ConstantOperands, Predicate::ConstantOperands
- Defined in:
- lib/veritas/optimizer/function/binary.rb
Overview
Optimize when the operands are constants
Instance Method Summary collapse
-
#optimizable? ⇒ Boolean
private
Test if the operands are constants.
-
#optimize ⇒ Object
private
Evaluate the operands and return the constant.
Instance Method Details
#optimizable? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test if the operands are constants
63 64 65 66 |
# File 'lib/veritas/optimizer/function/binary.rb', line 63 def optimizable? util = Util util.constant?(left) && util.constant?(right) end |
#optimize ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Evaluate the operands and return the constant
73 74 75 |
# File 'lib/veritas/optimizer/function/binary.rb', line 73 def optimize operation.class.call(left, right) end |