Class: Bio::PhyloXML::Uri

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

Overview

A uniform resource identifier. In general, this is expected to be an URL (for example, to link to an image on a website, in which case the ‘type’ attribute might be ‘image’ and ‘desc’ might be ‘image of a California sea hare’)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descObject

String. Description of the uri. For example, image of a California sea hare’



680
681
682
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 680

def desc
  @desc
end

#typeObject

String. For example, image.



682
683
684
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 682

def type
  @type
end

#uriObject

String. URL of the resource.



684
685
686
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 684

def uri
  @uri
end

Instance Method Details

#to_xmlObject

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



687
688
689
690
691
692
693
694
695
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 687

def to_xml        
  if @uri != nil
    xml_node = LibXML::XML::Node.new('uri', @uri)
    Writer.generate_xml(xml_node, self, [
      [:attr, 'desc'],
      [:attr, 'type']])
    return xml_node
  end
end