Class Bio::PhyloXML::Date
In: lib/bio/db/phyloxml/phyloxml_elements.rb
Parent: Object

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’).

Methods

maximum=   minimum=   to_s   to_xml   value=  

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

[Source]

     # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 810
810:       def maximum=(str)
811:         @maximum = str.to_i
812:       end

[Source]

     # 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"

[Source]

     # 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.

[Source]

     # 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

[Source]

     # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 814
814:       def value= (str)
815:         @value = str.to_i
816:       end

[Validate]