Class: VORuby::VOEvent::V1_1::What
- Defined in:
- lib/voruby/voevent/1.1/voevent.rb
Overview
Event characterization.
Instance Attribute Summary collapse
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#params ⇒ Object
Returns the value of attribute params.
Attributes inherited from Described
Class Method Summary collapse
Instance Method Summary collapse
- #==(w) ⇒ Object
-
#initialize(groups, params = nil, descriptions = nil, references = nil) ⇒ What
constructor
A new instance of What.
- #to_xml(name = nil) ⇒ Object
Methods inherited from Described
Methods included from SerializableToXml
Constructor Details
#initialize(groups, params = nil, descriptions = nil, references = nil) ⇒ What
Returns a new instance of What.
675 676 677 678 679 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 675 def initialize(groups, params=nil, descriptions=nil, references=nil) super(descriptions, references) self.groups = groups self.params = params end |
Instance Attribute Details
#groups ⇒ Object
Returns the value of attribute groups.
673 674 675 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 673 def groups @groups end |
#params ⇒ Object
Returns the value of attribute params.
673 674 675 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 673 def params @params end |
Class Method Details
.from_xml(xml) ⇒ Object
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 715 def self.from_xml(xml) root = element_from(xml) groups = REXML::XPath.match(root, 'x:Group', {'x' => obj_ns.uri}) groups = nil if groups.size == 0 params = REXML::XPath.match(root, 'x:Param', {'x' => obj_ns.uri}) params = nil if params.size == 0 self.new( groups ? GroupList.new(groups.collect{ |g| Group.from_xml(g) }) : nil, params ? ParamList.new(params.collect{ |p| Param.from_xml(p) }) : nil, *Described.described_from_xml(root) ) end |
Instance Method Details
#==(w) ⇒ Object
699 700 701 702 703 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 699 def ==(w) super(w) and self.groups == w.groups and self.params == w.params end |
#to_xml(name = nil) ⇒ Object
705 706 707 708 709 710 711 712 713 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 705 def to_xml(name=nil) el = super(name) self.groups.each{ |g| el.add_element(g.to_xml('Group')) } if self.groups self.params.each{ |p| el.add_element(p.to_xml('Param')) } if self.params collapse_namespaces(el) el end |