Class: VORuby::VOEvent::V1_1::Citations

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

Overview

Follow-up Observations.

Defined Under Namespace

Classes: EventIVORNList

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(ivorns, descriptions = nil, references = nil) ⇒ Citations

Returns a new instance of Citations.



228
229
230
231
# File 'lib/voruby/voevent/1.1/voevent.rb', line 228

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

Instance Attribute Details

#event_ivornsObject

Returns the value of attribute event_ivorns.



226
227
228
# File 'lib/voruby/voevent/1.1/voevent.rb', line 226

def event_ivorns
  @event_ivorns
end

Class Method Details

.from_xml(xml) ⇒ Object



256
257
258
259
260
261
262
263
264
265
266
# File 'lib/voruby/voevent/1.1/voevent.rb', line 256

def self.from_xml(xml)
  root = element_from(xml)
  
  ivorns = REXML::XPath.match(root, 'x:EventIVORN', {'x' => obj_ns.uri})
  ivorns = nil if ivorns.size == 0
  
  self.new(
    ivorns ? EventIVORNList.new(ivorns.collect{ |e| EventIVORN.from_xml(e) }) : nil,
    *Described.described_from_xml(root)
  )
end

Instance Method Details

#==(c) ⇒ Object



242
243
244
245
# File 'lib/voruby/voevent/1.1/voevent.rb', line 242

def ==(c)
  super(c) and
  self.event_ivorns == c.event_ivorns
end

#to_xml(name = nil) ⇒ Object



247
248
249
250
251
252
253
254
# File 'lib/voruby/voevent/1.1/voevent.rb', line 247

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