Class: VORuby::ADQL::V1_0::OrderExpression

Inherits:
Object
  • Object
show all
Includes:
SerializableToXml
Defined in:
lib/voruby/adql/1.0/adql.rb

Overview

List of expressions in which order the results should be provided

Defined Under Namespace

Classes: OrderList

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(items) ⇒ OrderExpression

Returns a new instance of OrderExpression.



2003
2004
2005
# File 'lib/voruby/adql/1.0/adql.rb', line 2003

def initialize(items)
  self.items = items
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



1999
2000
2001
# File 'lib/voruby/adql/1.0/adql.rb', line 1999

def items
  @items
end

Class Method Details

.from_xml(xml) ⇒ Object



2033
2034
2035
2036
2037
2038
2039
2040
2041
# File 'lib/voruby/adql/1.0/adql.rb', line 2033

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    OrderExpression::OrderList.new(
      REXML::XPath.match(root, 'x:Item', {'x' => obj_ns.uri}).collect{ |iel| xml_to_obj(iel) }
    )
  )
end

.xml_typeObject



2001
# File 'lib/voruby/adql/1.0/adql.rb', line 2001

def self.xml_type; 'orderExpressionType' end

Instance Method Details

#==(e) ⇒ Object



2016
2017
2018
# File 'lib/voruby/adql/1.0/adql.rb', line 2016

def ==(e)
  self.items == e.items
end

#to_sObject



2020
2021
2022
# File 'lib/voruby/adql/1.0/adql.rb', line 2020

def to_s
  "ORDER BY #{self.items.collect{ |i| i.to_s }.join(', ')}"
end

#to_xml(name = nil) ⇒ Object



2024
2025
2026
2027
2028
2029
2030
2031
# File 'lib/voruby/adql/1.0/adql.rb', line 2024

def to_xml(name=nil)
  el = element_root(name)
  
  self.items.collect{ |i| el.add_element(i.to_xml('Item')) }
  
  collapse_namespaces(el)
  el
end