Module: Veritas::Optimizer::Function

Defined in:
lib/veritas/optimizer/function.rb,
lib/veritas/optimizer/function/unary.rb,
lib/veritas/optimizer/function/binary.rb,
lib/veritas/optimizer/function/numeric.rb,
lib/veritas/optimizer/function/predicate.rb,
lib/veritas/optimizer/function/string/length.rb,
lib/veritas/optimizer/function/numeric/modulo.rb,
lib/veritas/optimizer/function/predicate/match.rb,
lib/veritas/optimizer/function/numeric/addition.rb,
lib/veritas/optimizer/function/numeric/division.rb,
lib/veritas/optimizer/function/numeric/absolute.rb,
lib/veritas/optimizer/function/connective/binary.rb,
lib/veritas/optimizer/function/numeric/unary_plus.rb,
lib/veritas/optimizer/function/predicate/equality.rb,
lib/veritas/optimizer/function/predicate/no_match.rb,
lib/veritas/optimizer/function/numeric/subtraction.rb,
lib/veritas/optimizer/function/numeric/square_root.rb,
lib/veritas/optimizer/function/predicate/inclusion.rb,
lib/veritas/optimizer/function/numeric/unary_minus.rb,
lib/veritas/optimizer/function/connective/negation.rb,
lib/veritas/optimizer/function/predicate/less_than.rb,
lib/veritas/optimizer/function/predicate/exclusion.rb,
lib/veritas/optimizer/function/predicate/enumerable.rb,
lib/veritas/optimizer/function/predicate/inequality.rb,
lib/veritas/optimizer/function/predicate/comparable.rb,
lib/veritas/optimizer/function/connective/disjunction.rb,
lib/veritas/optimizer/function/numeric/exponentiation.rb,
lib/veritas/optimizer/function/predicate/greater_than.rb,
lib/veritas/optimizer/function/numeric/multiplication.rb,
lib/veritas/optimizer/function/connective/conjunction.rb,
lib/veritas/optimizer/function/predicate/less_than_or_equal_to.rb,
lib/veritas/optimizer/function/predicate/greater_than_or_equal_to.rb

Overview

Mixin for function optimizations

Defined Under Namespace

Modules: Binary, Connective, String, Unary, Util Classes: Numeric, Predicate

Class Method Summary collapse

Class Method Details

.optimize_functions(functions) ⇒ Hash{Attribute => Function}

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.

Optimize the summarizers

Parameters:

  • functions (Hash{Attribute => Function})

Returns:



27
28
29
30
31
32
33
# File 'lib/veritas/optimizer/function.rb', line 27

def self.optimize_functions(functions)
  optimized = {}
  functions.each do |attribute, function|
    optimized[attribute] = optimize_operand(function)
  end
  optimized.freeze
end

.optimize_operand(operand) ⇒ Object

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.

Optimize the operand if possible

Parameters:

  • operand (#optimize, Object)

Returns:

  • (Object)


16
17
18
# File 'lib/veritas/optimizer/function.rb', line 16

def self.optimize_operand(operand)
  operand.respond_to?(:optimize) ? operand.optimize : operand
end