class Axiom::Algebra::Rename
Rename
attributes in the header
Attributes
aliases[R]
The aliases for the relation
@return [Aliases]
@api private
directions[R]
The relation sort order
@return [Operation::Sorted::DirectionSet]
@api private
Public Class Methods
new(operand, aliases)
click to toggle source
Initialize a Rename
@param [Relation] operand
the relation to rename
@param [Hash, Aliases] aliases
the old and new attribute names
@return [undefined]
@api private
Calls superclass method
Axiom::Relation::Operation::Unary::new
# File lib/axiom/algebra/rename.rb, line 35 def initialize(operand, aliases) super(operand) @aliases = Aliases.coerce(@header, aliases) @header = @header.rename(@aliases) @directions = operand.directions.rename(@aliases) end
Public Instance Methods
delete(other)
click to toggle source
Delete a relation from the Rename
@example
new_relation = rename.delete(other)
@param [Relation] other
@return [Rename]
@api public
# File lib/axiom/algebra/rename.rb, line 87 def delete(other) other = coerce(other) operand.delete(other.rename(aliases.inverse)).rename(aliases) end
each() { |rename| ... }
click to toggle source
Iterate over each tuple in the set
@example
rename = Rename.new(operand, aliases) rename.each { |tuple| ... }
@yield [tuple]
@yieldparam [Tuple] tuple
each tuple in the set
@return [self]
@api public
# File lib/axiom/algebra/rename.rb, line 56 def each return to_enum unless block_given? operand.each { |tuple| yield tuple.rename(header) } self end
insert(other)
click to toggle source
Insert a relation into the Rename
@example
new_relation = rename.insert(other)
@param [Relation] other
@return [Rename]
@api public
# File lib/axiom/algebra/rename.rb, line 72 def insert(other) other = coerce(other) operand.insert(other.rename(aliases.inverse)).rename(aliases) end