Class: Locomotive::RelationalAlgebra::SortList

Inherits:
Object
  • Object
show all
Includes:
XML
Defined in:
lib/locomotive/relational_algebra/operators/ranking/rank_lists.rb

Instance Method Summary collapse

Methods included from XML

included, #quote

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

#attributesObject



23
24
25
# File 'lib/locomotive/relational_algebra/operators/ranking/rank_lists.rb', line 23

def attributes
  sort_list.keys
end

#cloneObject



38
39
40
# File 'lib/locomotive/relational_algebra/operators/ranking/rank_lists.rb', line 38

def clone
   SortList.new( sort_list.clone )
end

#to_xmlObject



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