Class: VORuby::VOEvent::V1_1::WhereWhen

Inherits:
Described show all
Defined in:
lib/voruby/voevent/1.1/voevent.rb

Overview

Space-Time Coordinates, uses the VO STC schema.

Defined Under Namespace

Classes: ObsDataLocationList

Instance Attribute Summary collapse

Attributes inherited from Described

#descriptions, #references

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Described

described_from_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(obs_data_locations = nil, descriptions = nil, references = nil) ⇒ WhereWhen

Returns a new instance of WhereWhen.



498
499
500
501
# File 'lib/voruby/voevent/1.1/voevent.rb', line 498

def initialize(obs_data_locations=nil, descriptions=nil, references=nil)
  super(descriptions, references)
  self.obs_data_locations = obs_data_locations
end

Instance Attribute Details

#obs_data_locationsObject

Returns the value of attribute obs_data_locations.



496
497
498
# File 'lib/voruby/voevent/1.1/voevent.rb', line 496

def obs_data_locations
  @obs_data_locations
end

Class Method Details

.from_xml(xml) ⇒ Object



526
527
528
529
530
531
532
533
534
535
536
# File 'lib/voruby/voevent/1.1/voevent.rb', line 526

def self.from_xml(xml)
  root = element_from(xml)
  
  locs = REXML::XPath.match(root, 'x:ObsDataLocation', {'x' => obj_ns('VORuby::STC::V1_30').uri})
  locs = nil if locs.size == 0
  
  self.new(
    locs ? ObsDataLocationList.new(locs.collect{ |l| ObsDataLocation.from_xml(l) }) : nil,
    *Described.described_from_xml(root)
  )
end

Instance Method Details

#==(w) ⇒ Object



512
513
514
515
# File 'lib/voruby/voevent/1.1/voevent.rb', line 512

def ==(w)
  super(w) and
  self.obs_data_locations == w.obs_data_locations
end

#to_xml(name = nil) ⇒ Object



517
518
519
520
521
522
523
524
# File 'lib/voruby/voevent/1.1/voevent.rb', line 517

def to_xml(name=nil)
  el = super(name)
  
  self.obs_data_locations.each{ |l| el.add_element(l.to_xml) } if self.obs_data_locations
  
  collapse_namespaces(el)
  el
end