Module: Dwca::Generator

Defined in:
lib/dwca/generator.rb

Class Method Summary (collapse)

Class Method Details

+ (String) get_archive

Generates a DwC-A from database data

Returns:

  • (String)


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

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