module Axiom::Optimizer::Function::Util

Utility methods for Function optimization

Public Class Methods

attribute?(operand) click to toggle source

Test if the operand is an attribute

@return [Boolean]

@api private

# File lib/axiom/optimizer/function.rb, line 52
def self.attribute?(operand)
  operand.kind_of?(Attribute)
end
constant?(operand) click to toggle source

Test if the operand is a constant

@return [Boolean]

@api private

# File lib/axiom/optimizer/function.rb, line 43
def self.constant?(operand)
  ! (operand.nil? || operand.respond_to?(:call))
end
max(operand) click to toggle source

Return the maximum value for the operand

@return [Object]

@api private

# File lib/axiom/optimizer/function.rb, line 74
def self.max(operand)
  if operand.respond_to?(:range)
    operand.range.last
  else
    operand
  end
end
min(operand) click to toggle source

Return the minimum value for the operand

@return [Object]

@api private

# File lib/axiom/optimizer/function.rb, line 61
def self.min(operand)
  if operand.respond_to?(:range)
    operand.range.first
  else
    operand
  end
end