Class: Axiom::Algebra::Rename
- Includes:
- Relation::Operation::Unary
- Defined in:
- lib/axiom/algebra/rename.rb,
lib/axiom/algebra/rename/aliases.rb
Overview
Rename attributes in the header
Defined Under Namespace
Modules: Methods Classes: Aliases
Instance Attribute Summary collapse
-
#aliases ⇒ Aliases
readonly
private
The aliases for the relation.
-
#directions ⇒ Operation::Sorted::DirectionSet
readonly
private
The relation sort order.
Attributes included from Operation::Unary
Attributes inherited from Relation
Instance Method Summary collapse
-
#delete(other) ⇒ Rename
Delete a relation from the Rename.
-
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set.
-
#initialize(operand, aliases) ⇒ undefined
constructor
private
Initialize a Rename.
-
#insert(other) ⇒ Rename
Insert a relation into the Rename.
Methods inherited from Relation
#==, #[], #empty?, #include?, #materialize, #materialized?, new, #replace
Methods included from Visitable
Constructor Details
#initialize(operand, aliases) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a Rename
35 36 37 38 39 40 |
# 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 |
Instance Attribute Details
#aliases ⇒ Aliases (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The aliases for the relation
16 17 18 |
# File 'lib/axiom/algebra/rename.rb', line 16 def aliases @aliases end |
#directions ⇒ Operation::Sorted::DirectionSet (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The relation sort order
23 24 25 |
# File 'lib/axiom/algebra/rename.rb', line 23 def directions @directions end |
Instance Method Details
#delete(other) ⇒ Rename
Delete a relation from the Rename
87 88 89 90 |
# File 'lib/axiom/algebra/rename.rb', line 87 def delete(other) other = coerce(other) operand.delete(other.rename(aliases.inverse)).rename(aliases) end |
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set
56 57 58 59 60 |
# 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) ⇒ Rename
Insert a relation into the Rename
72 73 74 75 |
# File 'lib/axiom/algebra/rename.rb', line 72 def insert(other) other = coerce(other) operand.insert(other.rename(aliases.inverse)).rename(aliases) end |