Class: Locomotive::RelationalAlgebra::SortList
- Inherits:
-
Object
- Object
- Locomotive::RelationalAlgebra::SortList
- Includes:
- XML
- Defined in:
- lib/locomotive/relational_algebra/operators/ranking/rank_lists.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #clone ⇒ Object
-
#initialize(hash) ⇒ SortList
constructor
A new instance of SortList.
- #to_xml ⇒ Object
Methods included from XML
Constructor Details
#initialize(hash) ⇒ SortList
Returns a new instance of SortList.
19 20 21 |
# File 'lib/locomotive/relational_algebra/operators/ranking/rank_lists.rb', line 19 def initialize(hash) self.sort_list = hash end |
Instance Method Details
#attributes ⇒ Object
23 24 25 |
# File 'lib/locomotive/relational_algebra/operators/ranking/rank_lists.rb', line 23 def attributes sort_list.keys end |
#clone ⇒ Object
38 39 40 |
# File 'lib/locomotive/relational_algebra/operators/ranking/rank_lists.rb', line 38 def clone SortList.new( sort_list.clone ) end |
#to_xml ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/locomotive/relational_algebra/operators/ranking/rank_lists.rb', line 27 def to_xml pos = -1 sort_list.collect do |attr, dir| column :name => attr.to_xml, :function => :sort, :position => pos += 1, :direction => dir.to_xml, :new => false end.join end |