class Axiom::Relation::Operation::Unwrap

A class representing a unwrapped relation

Attributes

attribute[R]

The unwrapped attribute

@return [Attribute::Relation]

@api private

Public Class Methods

new(operand, name) click to toggle source

Initialize a unwrapped relation

@param [Relation] operand @param [#to_sym] name @param [Enumerable<Axiom::Attribute>] attributes

@return [undefined]

@api private

Calls superclass method Axiom::Relation::Operation::Unary::new
# File lib/axiom/relation/operation/unwrap.rb, line 28
def initialize(operand, name)
  super(operand)
  @attribute = header[name]
  @outer     = header - [attribute]
  @header    = @outer.extend(attribute.header)
end

Public Instance Methods

each() { |project.join(header, tuple)| ... } click to toggle source

Iterate over each tuple in the set

@example

unwrapped = Unwrap.new(left, right)
unwrapped.each { |tuple| ... }

@yield [tuple]

@yieldparam [Tuple] tuple

each tuple in the set

@return [self]

@api public

# File lib/axiom/relation/operation/unwrap.rb, line 49
def each
  return to_enum unless block_given?
  operand.each do |tuple|
    yield tuple.project(@outer).join(header, tuple[attribute])
  end
  self
end