module Axiom::Optimizer::Function::Binary::ConstantOperands

Optimize when the operands are constants

Public Instance Methods

optimizable?() click to toggle source

Test if the operands are constants

@return [Boolean]

@api private

# File lib/axiom/optimizer/function/binary.rb, line 63
def optimizable?
  util = Util
  util.constant?(left) && util.constant?(right)
end
optimize() click to toggle source

Evaluate the operands and return the constant

@return [Object]

@api private

# File lib/axiom/optimizer/function/binary.rb, line 73
def optimize
  operation.class.call(left, right)
end