Class: Bio::PhyloXML::Reference

Inherits:
Object
  • Object
show all
Defined in:
lib/bio-phyloxml/phyloxml_elements.rb

Overview

Description

A literature reference for a clade. It is recommended to use the ‘doi’ attribute instead of the free text ‘desc’ element whenever possible.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descObject

String. Free text description.



985
986
987
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 985

def desc
  @desc
end

#doiObject

String. Digital Object Identifier.



982
983
984
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 982

def doi
  @doi
end

Instance Method Details

#to_xmlObject

Converts elements to xml representation. Called by PhyloXML::Writer class.



988
989
990
991
992
993
994
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 988

def to_xml
  ref = LibXML::XML::Node.new('reference')
  Writer.generate_xml(ref, self, [
        [:attr, 'doi'],
        [:simple, 'desc', (defined? @desc) ? @desc : nil]])
   return ref
end