class Axiom::Optimizer::Relation::Operation::Limit::LimitOperand

Optimize when the operand is a Limit

Public Instance Methods

optimizable?() click to toggle source

Test if the operand is a Limit

@return [Boolean]

@api private

# File lib/axiom/optimizer/relation/operation/limit.rb, line 87
def optimizable?
  operand.kind_of?(operation.class)
end
optimize() click to toggle source

Flatten Limit operations using the minimum limit

@return [Boolean]

@api private

# File lib/axiom/optimizer/relation/operation/limit.rb, line 96
def optimize
  operand.operand.take(min_limit)
end

Private Instance Methods

min_limit() click to toggle source

Return the minimum limit between the operation and operand

@return [Integer]

@api private

# File lib/axiom/optimizer/relation/operation/limit.rb, line 107
def min_limit
  [limit, operand.limit].min
end