Class | DataTable |
In: |
lib/data_table.rb
|
Parent: | Object |
Each EML document can contain DataTable elements representing(in most cases) plain text data. The attributes of this data, such as column names, types, domain info, are documented in the eml metadata. DataTable encapsulates data table elements from eml documents in the instance variable @metadata.
The purpose of this class is to provide methods to easily access metadata attributes pertaining to the data table. It can also be extended for specific applications to process the data based on the metadata description.
eml = metacat.find(:docid => 'somedoc.1.1') data_table = eml.data_tables[0] data_table.location => ecogrid://knb/pisco_cbs.30.3
# note we are using a block so the whole file isn't loaded to RAM file = File.new("./tmp/#{data_table.id}") data_table.read do |buffer| file.write(buffer) end file.close