Class: Veritas::Optimizer::Function::Connective::Binary::RedundantLeftOperand

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

Overview

Optimize when the left operand is redundant

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 left operand is redundant



205
206
207
208
# File 'lib/veritas/optimizer/function/connective/binary.rb', line 205

def optimizable?
  left = self.left
  operation.kind_of?(left.class) && right.eql?(left.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 a redundant left operand is equivalent to the left



215
216
217
# File 'lib/veritas/optimizer/function/connective/binary.rb', line 215

def optimize
  left
end