Method: BioCReader.read

Defined in:
lib/simple_bioc/bioc_reader.rb

.read(path, options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/simple_bioc/bioc_reader.rb', line 7

def read(path, options) 
  collection = nil
  File.open(path) do |file|
    xml_doc  = Nokogiri::XML(file) do |config|
      config.noent.strict.noblanks
    end
    xml = xml_doc.at_xpath("//collection")
    if xml.nil?
      fail 'Wrong format'
    end
    collection = SimpleBioC::Collection.new
    read_collection(xml, collection, options)
  end

  collection
end