Class: VORuby::ADQL::V1_0::ArchiveTable

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

Overview

Same as a Table with an additional archive name

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(archive, name, table_alias = nil) ⇒ ArchiveTable

Returns a new instance of ArchiveTable.



780
781
782
783
784
# File 'lib/voruby/adql/1.0/adql.rb', line 780

def initialize(archive, name, table_alias=nil)
  self.archive = archive
  self.name = name
  self.table_alias = table_alias
end

Instance Attribute Details

#archiveObject

Returns the value of attribute archive.



776
777
778
# File 'lib/voruby/adql/1.0/adql.rb', line 776

def archive
  @archive
end

#nameObject

Returns the value of attribute name.



776
777
778
# File 'lib/voruby/adql/1.0/adql.rb', line 776

def name
  @name
end

#table_aliasObject

Returns the value of attribute table_alias.



776
777
778
# File 'lib/voruby/adql/1.0/adql.rb', line 776

def table_alias
  @table_alias
end

Class Method Details

.from_xml(xml) ⇒ Object



822
823
824
825
826
827
828
829
830
831
# File 'lib/voruby/adql/1.0/adql.rb', line 822

def self.from_xml(xml)
  root = element_from(xml)
  
  table_alias = root.attributes.get_attribute_ns(obj_ns.uri, 'Alias')
  self.new(
    root.attributes.get_attribute_ns(obj_ns.uri, 'Archive').value,
    root.attributes.get_attribute_ns(obj_ns.uri, 'Name').value,
    table_alias ? table_alias.value : nil
  )
end

.xml_typeObject



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

def self.xml_type; 'archiveTableType' end

Instance Method Details

#==(t) ⇒ Object



800
801
802
803
804
# File 'lib/voruby/adql/1.0/adql.rb', line 800

def ==(t)
  self.archive == t.archive and
  self.name == t.name and
  self.table_alias == t.table_alias
end

#to_sObject



806
807
808
809
810
# File 'lib/voruby/adql/1.0/adql.rb', line 806

def to_s
  t = "#{self.archive}:#{self.name}"
  t = "#{t} #{self.table_alias}" if self.table_alias
  t
end

#to_xml(name = nil) ⇒ Object



812
813
814
815
816
817
818
819
820
# File 'lib/voruby/adql/1.0/adql.rb', line 812

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:Archive"] = self.archive
  el.attributes["#{obj_ns.prefix}:Name"] = self.name
  el.attributes["#{obj_ns.prefix}:Alias"] = self.table_alias if self.table_alias
  
  el
end