Class: VORuby::ADQL::OrderExpression

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/adql/adql.rb,
lib/voruby/adql/transforms.rb

Overview

List of expressions in which order the results should be provided.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(items) ⇒ OrderExpression

Returns a new instance of OrderExpression.



2320
2321
2322
# File 'lib/voruby/adql/adql.rb', line 2320

def initialize(items)
  self.items = items
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



2318
2319
2320
# File 'lib/voruby/adql/adql.rb', line 2318

def items
  @items
end

Class Method Details

.from_xml(node) ⇒ Object



2339
2340
2341
2342
2343
2344
2345
2346
2347
# File 'lib/voruby/adql/adql.rb', line 2339

def self.from_xml(node)
  items = []
  node.elements.each('Item') do |item_node|
    item = Item.from_xml(item_node)
    items.push(item)
  end

  return OrderExpression.new(items)
end

Instance Method Details

#to_adqlsObject



470
471
472
473
# File 'lib/voruby/adql/transforms.rb', line 470

def to_adqls
  items = self.items.collect{|x| x.to_adqls}.join(', ')
  "ORDER BY #{items}"
end

#to_sObject



2334
2335
2336
2337
# File 'lib/voruby/adql/adql.rb', line 2334

def to_s
  items = self.items.collect{|x| x.to_s}.join('|')
  "{items=#{items}}"
end