class Bio::PhyloXML::Date
Description¶ ↑
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').
Attributes
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.
Public Instance Methods
maximum=(str)
click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 810 def maximum=(str) @maximum = str.to_i end
minimum=(str)
click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 806 def minimum=(str) @minimum = str.to_i end
to_s()
click to toggle source
Returns value + unit, for exampe “7 mya”
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 819 def to_s return "#{value} #{unit}" end
to_xml()
click to toggle source
Converts elements to xml representation. Called by PhyloXML::Writer class.
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 824 def to_xml date = LibXML::XML::Node.new('date') PhyloXML::Writer.generate_xml(date, self, [ [:attr, 'unit'], [:simple, 'desc', @desc], [:simple, 'value', @value], [:simple, 'minimum', @minimum], [:simple, 'maximum', @maximum]]) return date end
value=(str)
click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 814 def value= (str) @value = str.to_i end