Class: VORuby::ADQL::V1_0::ConstantListSet

Inherits:
InclusionSet show all
Defined in:
lib/voruby/adql/1.0/adql.rb

Overview

Represents a list of constants provided for a SQL IN expression

Defined Under Namespace

Classes: LiteralList

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(items) ⇒ ConstantListSet

Returns a new instance of ConstantListSet.



2064
2065
2066
# File 'lib/voruby/adql/1.0/adql.rb', line 2064

def initialize(items)
  self.items = items
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



2060
2061
2062
# File 'lib/voruby/adql/1.0/adql.rb', line 2060

def items
  @items
end

Class Method Details

.from_xml(xml) ⇒ Object



2094
2095
2096
2097
2098
2099
2100
2101
2102
# File 'lib/voruby/adql/1.0/adql.rb', line 2094

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

.xml_typeObject



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

def self.xml_type; 'ConstantListSet' end

Instance Method Details

#==(s) ⇒ Object



2077
2078
2079
# File 'lib/voruby/adql/1.0/adql.rb', line 2077

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

#to_sObject



2081
2082
2083
# File 'lib/voruby/adql/1.0/adql.rb', line 2081

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

#to_xml(name = nil) ⇒ Object



2085
2086
2087
2088
2089
2090
2091
2092
# File 'lib/voruby/adql/1.0/adql.rb', line 2085

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