Module: Dwca::Generator

Defined in:
lib/dwca/generator.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) get_archive

Generates a DwC-A from database data



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dwca/generator.rb', line 4

def self.get_archive
  path = Rails.root.join('tmp/dwc_' + SecureRandom.hex + '.tar.gz')
  gen = DarwinCore::Generator.new(path)
  
  core = [["http://rs.tdwg.org/dwc/terms/taxonID"]]
  gen.add_core(core, 'core.txt')
  gen.add_meta_xml
  gen.pack
  gen.clean
  
  return path
end