module Axiom::Optimizer::Function::Predicate::Comparable::NeverEquivalent
Optimize when the operands will never be equivalent
Public Instance Methods
optimizable?()
click to toggle source
Test if the operands will never be equivalent
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/predicate/comparable.rb, line 43 def optimizable? util = Util if nil_operand? then true elsif util.constant?(left) then left_invalid_constant? elsif util.constant?(right) then right_invalid_constant? else !joinable? end end
Private Instance Methods
joinable?()
click to toggle source
Test if the left and right operand are joinable
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/predicate/comparable.rb, line 87 def joinable? left.eql?(right.rename(left.name)) end
left_invalid_constant?()
click to toggle source
Test if the left operand is an invalid constant
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/predicate/comparable.rb, line 69 def left_invalid_constant? !right.include?(left) end
nil_operand?()
click to toggle source
Test if an operand is nil
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/predicate/comparable.rb, line 60 def nil_operand? left.nil? || right.nil? end
right_invalid_constant?()
click to toggle source
Test if the right operand is an invalid constant
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/predicate/comparable.rb, line 78 def right_invalid_constant? !left.include?(right) end