Class: Axiom::Optimizer::Function::Connective::Binary::EqualOperands

Inherits:
Axiom::Optimizer::Function::Connective::Binary show all
Defined in:
lib/axiom/optimizer/function/connective/binary.rb

Overview

Optimize when the operands are equal

Constant Summary

Constants inherited from Axiom::Optimizer

Identity, VERSION

Instance Attribute Summary

Attributes included from Binary

#left, #right

Attributes inherited from Axiom::Optimizer

#operation

Instance Method Summary collapse

Methods included from Binary

#initialize

Methods inherited from Axiom::Optimizer

chain, #initialize

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 equal

Returns:

  • (Boolean)


176
177
178
# File 'lib/axiom/optimizer/function/connective/binary.rb', line 176

def optimizable?
  left.eql?(right)
end

#optimizeFunction

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.

A Binary connective with equal operands is equivalent to the left

Returns:



185
186
187
# File 'lib/axiom/optimizer/function/connective/binary.rb', line 185

def optimize
  left
end