Class: Axiom::Relation::Operation::Reverse

Inherits:
Sorted show all
Defined in:
lib/axiom/relation/operation/reverse.rb

Overview

A class representing a reverse sorted relation

Defined Under Namespace

Modules: Methods

Instance Attribute Summary

Attributes inherited from Sorted

#directions

Attributes included from Operation::Unary

#operand

Attributes inherited from Axiom::Relation

#header

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Sorted

#delete, #initialize, #insert

Methods included from Unary

#initialize

Methods included from Operation::Unary

#initialize

Methods inherited from Axiom::Relation

#==, #[], #directions, #empty?, #include?, #initialize, #materialize, #materialized?, #replace

Methods included from Visitable

#accept

Constructor Details

This class inherits a constructor from Axiom::Relation::Operation::Sorted

Class Method Details

.new(operand) ⇒ Reverse

Instantiate a new Reverse relation

Examples:

reverse = Reverse.new(operand)

Parameters:

Returns:



20
21
22
23
# File 'lib/axiom/relation/operation/reverse.rb', line 20

def self.new(operand)
  assert_sorted_operand(operand)
  super(operand, operand.directions.reverse)
end

Instance Method Details

#each {|tuple| ... } ⇒ self

Iterate over each tuple in the set

Examples:

reverse = Reverse.new(operand)
reverse.each { |tuple| ... }

Yields:

  • (tuple)

Yield Parameters:

  • tuple (Tuple)

    each tuple in the set

Returns:

  • (self)


57
58
59
60
61
# 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