Class: Veritas::Optimizer::Function::Connective::Binary::EqualOperands

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

Overview

Optimize when the operands are equal

Constant Summary

Constants inherited from Veritas::Optimizer

Noop, VERSION

Instance Attribute Summary

Attributes included from Binary

#left, #right

Attributes inherited from Veritas::Optimizer

#operation

Instance Method Summary collapse

Methods included from Binary

#initialize

Methods inherited from Veritas::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)


182
183
184
# File 'lib/veritas/optimizer/function/connective/binary.rb', line 182

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:



191
192
193
# File 'lib/veritas/optimizer/function/connective/binary.rb', line 191

def optimize
  left
end