lib/dwc_archive/generator.rb in dwc-archive-1.1.1 vs lib/dwc_archive/generator.rb in dwc-archive-1.1.2
- old
+ new
@@ -10,26 +10,26 @@
@path = DarwinCore.random_path(tmp_dir)
FileUtils.mkdir(@path)
@meta_xml_data = { extensions: [] }
@eml_xml_data = { id: nil, title: nil, authors: [], abstrac: nil,
citation: nil, url: nil }
- @write = "w:utf-8"
+ @write = 'w:utf-8'
end
def clean
DarwinCore.clean(@path)
end
def add_core(data, file_name, keep_headers = true)
- opts = { type: "core", data: data, file_name: file_name,
+ opts = { type: 'core', data: data, file_name: file_name,
keep_headers: keep_headers }
prepare_csv_file(opts)
end
def add_extension(data, file_name, keep_headers = true,
- row_type = "http://rs.tdwg.org/dwc/terms/Taxon")
- opts = { type: "extension", data: data, file_name: file_name,
+ row_type = 'http://rs.tdwg.org/dwc/terms/Taxon')
+ opts = { type: 'extension', data: data, file_name: file_name,
keep_headers: keep_headers, row_type: row_type }
prepare_csv_file(opts)
end
def add_meta_xml
@@ -55,11 +55,11 @@
private
def prepare_csv_file(opts)
c = CSV.open(File.join(@path, opts[:file_name]), @write)
attributes = prepare_attributes(opts)
- if opts[:type] == "core"
+ if opts[:type] == 'core'
@meta_xml_data[:core] = attributes
else
@meta_xml_data[:extensions] << attributes
end
opts[:data].each { |d| c << d }
@@ -81,10 +81,11 @@
def init_fields(header, file_type)
header.map do |f|
f = f.strip
err = "No header in #{file_type} data, or header fields are not urls"
raise DarwinCore::GeneratorError, err unless f =~ %r{^http://}
- f.split("/")[-1]
+
+ f.split('/')[-1]
end
end
end
end