Module: Axiom::Optimizer::Function::Util
- Defined in:
- lib/axiom/optimizer/function.rb
Overview
Utility methods for Function optimization
Class Method Summary collapse
-
.attribute?(operand) ⇒ Boolean
private
Test if the operand is an attribute.
-
.constant?(operand) ⇒ Boolean
private
Test if the operand is a constant.
-
.max(operand) ⇒ Object
private
Return the maximum value for the operand.
-
.min(operand) ⇒ Object
private
Return the minimum value for the operand.
Class Method Details
.attribute?(operand) ⇒ 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 operand is an attribute
52 53 54 |
# File 'lib/axiom/optimizer/function.rb', line 52 def self.attribute?(operand) operand.kind_of?(Attribute) end |
.constant?(operand) ⇒ 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 operand is a constant
43 44 45 |
# File 'lib/axiom/optimizer/function.rb', line 43 def self.constant?(operand) ! (operand.nil? || operand.respond_to?(:call)) end |
.max(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.
Return the maximum value for the operand
74 75 76 77 78 79 80 |
# 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) ⇒ 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.
Return the minimum value for the operand
61 62 63 64 65 66 67 |
# File 'lib/axiom/optimizer/function.rb', line 61 def self.min(operand) if operand.respond_to?(:range) operand.range.first else operand end end |