Class | Bio::PhyloXML::Date |
In: |
lib/bio/db/phyloxml/phyloxml_elements.rb
|
Parent: | Object |
A date associated with a clade/node. Its value can be numerical by using the ‘value’ element and/or free text with the ‘desc’ element’ (e.g. ‘Silurian’). If a numerical value is used, it is recommended to employ the ‘unit’ attribute to indicate the type of the numerical value (e.g. ‘mya’ for ‘million years ago’).
desc | [RW] | Free text description of the date. |
maximum | [R] | Integer. Minimum and maximum of the value. |
minimum | [R] | Integer. Minimum and maximum of the value. |
unit | [RW] | String. Units in which value is stored. |
value | [R] | Integer. Value of the date. |
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 810 810: def maximum=(str) 811: @maximum = str.to_i 812: end
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 806 806: def minimum=(str) 807: @minimum = str.to_i 808: end
Returns value + unit, for exampe "7 mya"
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 819 819: def to_s 820: return "#{value} #{unit}" 821: end
Converts elements to xml representation. Called by PhyloXML::Writer class.
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 824 824: def to_xml 825: date = LibXML::XML::Node.new('date') 826: PhyloXML::Writer.generate_xml(date, self, [ 827: [:attr, 'unit'], 828: [:simple, 'desc', @desc], 829: [:simple, 'value', @value], 830: [:simple, 'minimum', @minimum], 831: [:simple, 'maximum', @maximum]]) 832: return date 833: end