Class: VORuby::ADQL::V1_0::SelectionList

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

Overview

List of items to be selected in the Query

Defined Under Namespace

Classes: ItemList

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(items) ⇒ SelectionList

Returns a new instance of SelectionList.



1757
1758
1759
# File 'lib/voruby/adql/1.0/adql.rb', line 1757

def initialize(items)
  self.items = items
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



1748
1749
1750
# File 'lib/voruby/adql/1.0/adql.rb', line 1748

def items
  @items
end

Class Method Details

.from_xml(xml) ⇒ Object



1787
1788
1789
1790
1791
1792
1793
1794
1795
# File 'lib/voruby/adql/1.0/adql.rb', line 1787

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

.xml_typeObject



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

def self.xml_type; 'selectionListType' end

Instance Method Details

#==(l) ⇒ Object



1770
1771
1772
# File 'lib/voruby/adql/1.0/adql.rb', line 1770

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

#to_sObject



1774
1775
1776
# File 'lib/voruby/adql/1.0/adql.rb', line 1774

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

#to_xml(name = nil) ⇒ Object



1778
1779
1780
1781
1782
1783
1784
1785
# File 'lib/voruby/adql/1.0/adql.rb', line 1778

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