class Axiom::Relation::Operation::Reverse
A class representing a reverse sorted relation
Public Class Methods
new(operand)
click to toggle source
Instantiate a new Reverse
relation
@example
reverse = Reverse.new(operand)
@param [Relation] operand
@return [Reverse]
@api public
Calls superclass method
# File lib/axiom/relation/operation/reverse.rb, line 20 def self.new(operand) assert_sorted_operand(operand) super(operand, operand.directions.reverse) end
Private Class Methods
assert_sorted_operand(operand)
click to toggle source
Assert the operand is sorted
@param [Relation] operand
@return [undefined]
@raise [SortededRelationRequiredError]
raise if the operand is unsorted
@api private
# File lib/axiom/relation/operation/reverse.rb, line 35 def self.assert_sorted_operand(operand) if operand.header.size != operand.directions.size fail SortededRelationRequiredError, 'can only reverse a sorted operand' end end
Public Instance Methods
each() { |tuple| ... }
click to toggle source
Iterate over each tuple in the set
@example
reverse = Reverse.new(operand) reverse.each { |tuple| ... }
@yield [tuple]
@yieldparam [Tuple] tuple
each tuple in the set
@return [self]
@api public
# File lib/axiom/relation/operation/reverse.rb, line 57 def each return to_enum unless block_given? operand.reverse_each { |tuple| yield tuple } self end