Class: Bio::PhyloXML::Other
- Inherits:
-
Object
- Object
- Bio::PhyloXML::Other
- Defined in:
- lib/bio-phyloxml/phyloxml_elements.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#children ⇒ Object
Returns the value of attribute children.
-
#element_name ⇒ Object
Returns the value of attribute element_name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize ⇒ Other
constructor
A new instance of Other.
-
#to_xml ⇒ Object
Converts elements to xml representation.
Constructor Details
#initialize ⇒ Other
Returns a new instance of Other.
1163 1164 1165 1166 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1163 def initialize @children = [] @attributes = Hash.new end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
1161 1162 1163 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1161 def attributes @attributes end |
#children ⇒ Object
Returns the value of attribute children.
1161 1162 1163 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1161 def children @children end |
#element_name ⇒ Object
Returns the value of attribute element_name.
1161 1162 1163 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1161 def element_name @element_name end |
#value ⇒ Object
Returns the value of attribute value.
1161 1162 1163 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1161 def value @value end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1169 def to_xml o = LibXML::XML::Node.new(@element_name) @attributes.each do |key, value| o[key] = value end o << value if value != nil children.each do |child_node| o << child_node.to_xml end return o end |