Class: Bio::PhyloXML::Date
- Inherits:
-
Object
- Object
- Bio::PhyloXML::Date
- Defined in:
- lib/bio/phyloxml/elements.rb
Overview
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’).
Instance Attribute Summary collapse
-
#desc ⇒ Object
Free text description of the date.
-
#maximum ⇒ Object
Integer.
-
#minimum ⇒ Object
Integer.
-
#unit ⇒ Object
String.
-
#value ⇒ Object
Integer.
Instance Method Summary collapse
-
#to_s ⇒ Object
Returns value + unit, for exampe “7 mya”.
-
#to_xml ⇒ Object
Converts elements to xml representation.
Instance Attribute Details
#desc ⇒ Object
Free text description of the date.
790 791 792 |
# File 'lib/bio/phyloxml/elements.rb', line 790 def desc @desc end |
#maximum ⇒ Object
Integer. Minimum and maximum of the value.
793 794 795 |
# File 'lib/bio/phyloxml/elements.rb', line 793 def maximum @maximum end |
#minimum ⇒ Object
Integer. Minimum and maximum of the value.
793 794 795 |
# File 'lib/bio/phyloxml/elements.rb', line 793 def minimum @minimum end |
#unit ⇒ Object
String. Units in which value is stored.
787 788 789 |
# File 'lib/bio/phyloxml/elements.rb', line 787 def unit @unit end |
#value ⇒ Object
Integer. Value of the date.
796 797 798 |
# File 'lib/bio/phyloxml/elements.rb', line 796 def value @value end |
Instance Method Details
#to_s ⇒ Object
Returns value + unit, for exampe “7 mya”
811 812 813 |
# File 'lib/bio/phyloxml/elements.rb', line 811 def to_s return "#{value} #{unit}" end |
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
816 817 818 819 820 821 822 823 824 825 |
# File 'lib/bio/phyloxml/elements.rb', line 816 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 |