Class: Bio::PhyloXML::Polygon
- Inherits:
-
Object
- Object
- Bio::PhyloXML::Polygon
- Defined in:
- lib/bio-phyloxml/phyloxml_elements.rb
Overview
Description
A polygon defined by a list of Points objects.
Instance Attribute Summary collapse
-
#points ⇒ Object
Array of Point objects.
Instance Method Summary collapse
-
#initialize ⇒ Polygon
constructor
A new instance of Polygon.
-
#to_xml ⇒ Object
Converts elements to xml representation.
Constructor Details
#initialize ⇒ Polygon
Returns a new instance of Polygon.
489 490 491 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 489 def initialize @points = [] end |
Instance Attribute Details
#points ⇒ Object
Array of Point objects.
487 488 489 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 487 def points @points end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
495 496 497 498 499 500 501 502 503 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 495 def to_xml if @points.length > 2 pol = LibXML::XML::Node.new('polygon') @points.each do |p| pol << p.to_xml end return pol end end |