class Axiom::Relation::Operation::Wrap
A class representing a wrapped relation
Attributes
attribute[R]
The wrapped attribute
@return [Attribute::Relation]
@api private
Public Class Methods
new(operand, name, attributes)
click to toggle source
Initialize a wrapped 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/wrap.rb, line 28 def initialize(operand, name, attributes) super(operand) inner = header.project(attributes) @outer = header - inner @attribute = Attribute::Tuple.new(name, header: inner) @header = @outer.extend(attribute) end
Public Instance Methods
each() { |extend(header, [inner_tuple])| ... }
click to toggle source
Iterate over each tuple in the set
@example
wrapped = Wrap.new(operand, name attributes) wrapped.each { |tuple| ... }
@yield [tuple]
@yieldparam [Tuple] tuple
each tuple in the set
@return [self]
@api public
# File lib/axiom/relation/operation/wrap.rb, line 50 def each return to_enum unless block_given? operand.each do |tuple| outer_tuple = tuple.project(@outer) inner_tuple = tuple.project(attribute.header) yield outer_tuple.extend(header, [inner_tuple]) end self end