Class: Axiom::Relation::Operation::Sorted::DirectionSet
- Defined in:
- lib/axiom/relation/operation/sorted/direction_set.rb
Overview
A class that represents a tuple sort order for a set of attributes
Instance Attribute Summary
Attributes inherited from Header
Instance Method Summary collapse
-
#attributes ⇒ Array
private
Return each attribute in an Array.
-
#rename(aliases) ⇒ DirectionSet
Rename the contained attributes with the provided aliases.
-
#reverse ⇒ DirectionSet
Reverse the directions for each attribute.
-
#sort_tuples(tuples) ⇒ Array
private
Sort the supplied tuples in the correct direction.
Methods inherited from Header
coerce, #context, #difference, #each, #empty?, #extend, #fetch, #initialize, #intersect, new, #project, #size, #union
Methods included from Aliasable
Constructor Details
This class inherits a constructor from Axiom::Relation::Header
Instance Method Details
#attributes ⇒ Array
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.
Return each attribute in an Array
57 58 59 |
# File 'lib/axiom/relation/operation/sorted/direction_set.rb', line 57 def attributes map(&:attribute) end |
#rename(aliases) ⇒ DirectionSet
Rename the contained attributes with the provided aliases
36 37 38 |
# File 'lib/axiom/relation/operation/sorted/direction_set.rb', line 36 def rename(aliases) new(map { |direction| direction.rename(aliases) }) end |
#reverse ⇒ DirectionSet
Reverse the directions for each attribute
48 49 50 |
# File 'lib/axiom/relation/operation/sorted/direction_set.rb', line 48 def reverse new(map(&:reverse)) end |
#sort_tuples(tuples) ⇒ Array
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.
Sort the supplied tuples in the correct direction
70 71 72 |
# File 'lib/axiom/relation/operation/sorted/direction_set.rb', line 70 def sort_tuples(tuples) tuples.to_a.sort { |left, right| cmp_tuples(left, right) } end |