Class: VORuby::VOEvent::V1_1::Param
- Defined in:
- lib/voruby/voevent/1.1/voevent.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#ucd ⇒ Object
Returns the value of attribute ucd.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(p) ⇒ Object
-
#initialize(name, value, ucd = nil, unit = nil) ⇒ Param
constructor
A new instance of Param.
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(name, value, ucd = nil, unit = nil) ⇒ Param
Returns a new instance of Param.
542 543 544 545 546 547 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 542 def initialize(name, value, ucd=nil, unit=nil) self.name = name self.value = value self.ucd = ucd self.unit = unit end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
540 541 542 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 540 def name @name end |
#ucd ⇒ Object
Returns the value of attribute ucd.
540 541 542 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 540 def ucd @ucd end |
#unit ⇒ Object
Returns the value of attribute unit.
540 541 542 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 540 def unit @unit end |
#value ⇒ Object
Returns the value of attribute value.
540 541 542 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 540 def value @value end |
Class Method Details
.from_xml(xml) ⇒ Object
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 583 def self.from_xml(xml) root = element_from(xml) name = root.attributes.get_attribute_ns(obj_ns.uri, 'name') value = root.attributes.get_attribute_ns(obj_ns.uri, 'value') ucd = root.attributes.get_attribute_ns(obj_ns.uri, 'ucd') unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit') self.new( name ? name.value : nil, value ? value.value : nil, ucd ? ucd.value : nil, unit ? unit.value : nil ) end |
Instance Method Details
#==(p) ⇒ Object
565 566 567 568 569 570 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 565 def ==(p) self.name == p.name and self.value == p.value and self.ucd == p.ucd and self.unit == p.unit end |
#to_xml(name = nil) ⇒ Object
572 573 574 575 576 577 578 579 580 581 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 572 def to_xml(name=nil) el = element(name) el.attributes["#{obj_ns.prefix}:name"] = self.name if self.name el.attributes["#{obj_ns.prefix}:value"] = self.value if self.value el.attributes["#{obj_ns.prefix}:ucd"] = self.ucd if self.ucd el.attributes["#{obj_ns.prefix}:unit"] = self.unit if self.unit el end |