Method: Bio::FANTOM::MaXML#initialize

Defined in:
lib/bio/db/fantom.rb

#initialize(x) ⇒ MaXML

Returns a new instance of MaXML.



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/bio/db/fantom.rb', line 62

def initialize(x)
  if x.is_a?(REXML::Element) then
    @elem = x
  else
    if x.is_a?(String) then
      x = x.sub(/#{Regexp.escape(DELIMITER)}\z/om, "\n")
    end
    doc = REXML::Document.new(x)
    @elem = doc.elements[self.class::Data_XPath]
    #raise 'element is null' unless @elem
    @elem = REXML::Document.new('') unless @elem
  end
end