Class: VORuby::VOEvent::V1_1::EventIVORN

Inherits:
Base
  • Object
show all
Defined in:
lib/voruby/voevent/1.1/voevent.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(uri, cite) ⇒ EventIVORN

Returns a new instance of EventIVORN.



108
109
110
111
# File 'lib/voruby/voevent/1.1/voevent.rb', line 108

def initialize(uri, cite)
  self.uri = uri
  self.cite = cite
end

Instance Attribute Details

#citeObject

Returns the value of attribute cite.



106
107
108
# File 'lib/voruby/voevent/1.1/voevent.rb', line 106

def cite
  @cite
end

#uriObject

Returns the value of attribute uri.



106
107
108
# File 'lib/voruby/voevent/1.1/voevent.rb', line 106

def uri
  @uri
end

Class Method Details

.from_xml(xml) ⇒ Object



141
142
143
144
145
146
147
148
# File 'lib/voruby/voevent/1.1/voevent.rb', line 141

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    root.text,
    Cite.new(root.attributes.get_attribute_ns(obj_ns.uri, 'cite').value)
  )
end

Instance Method Details

#==(i) ⇒ Object



127
128
129
130
# File 'lib/voruby/voevent/1.1/voevent.rb', line 127

def ==(i)
  self.uri == i.uri and
  self.cite == i.cite
end

#to_xml(name = nil) ⇒ Object



132
133
134
135
136
137
138
139
# File 'lib/voruby/voevent/1.1/voevent.rb', line 132

def to_xml(name=nil)
  el = element(name)
  
  el.text = self.uri.to_s
  el.attributes["#{obj_ns.prefix}:cite"] = self.cite.to_s
  
  el
end