Class: VORuby::VOEvent::V1_1::Group
- Defined in:
- lib/voruby/voevent/1.1/voevent.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#params ⇒ Object
Returns the value of attribute params.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Described
Class Method Summary collapse
Instance Method Summary collapse
- #==(g) ⇒ Object
-
#initialize(params, name = nil, type = nil, descriptions = nil, references = nil) ⇒ Group
constructor
A new instance of Group.
- #to_xml(name = nil) ⇒ Object
Methods inherited from Described
Methods included from SerializableToXml
Constructor Details
#initialize(params, name = nil, type = nil, descriptions = nil, references = nil) ⇒ Group
Returns a new instance of Group.
607 608 609 610 611 612 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 607 def initialize(params, name=nil, type=nil, descriptions=nil, references=nil) super(descriptions, references) self.params = params self.name = name self.type = type end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
605 606 607 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 605 def name @name end |
#params ⇒ Object
Returns the value of attribute params.
605 606 607 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 605 def params @params end |
#type ⇒ Object
Returns the value of attribute type.
605 606 607 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 605 def type @type end |
Class Method Details
.from_xml(xml) ⇒ Object
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 649 def self.from_xml(xml) root = element_from(xml) params = REXML::XPath.match(root, 'x:Param', {'x' => obj_ns.uri}) params = nil if params.size == 0 name = root.attributes.get_attribute_ns(obj_ns.uri, 'name') type = root.attributes.get_attribute_ns(obj_ns.uri, 'type') self.new( params ? ParamList.new(params.collect{ |p| Param.from_xml(p) }) : nil, name ? name.value : nil, type ? type.value : nil, *Described.described_from_xml(root) ) end |
Instance Method Details
#==(g) ⇒ Object
631 632 633 634 635 636 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 631 def ==(g) super(g) and self.params == g.params and self.name == g.name and self.type == g.type end |
#to_xml(name = nil) ⇒ Object
638 639 640 641 642 643 644 645 646 647 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 638 def to_xml(name=nil) el = super(name) el.attributes["#{obj_ns.prefix}:name"] = self.name if self.name el.attributes["#{obj_ns.prefix}:type"] = self.type if self.type self.params.each{ |p| el.add_element(p.to_xml('Param')) } if self.params el end |