Module: Bolognese::Writers::CsvWriter

Included in:
MetadataUtils
Defined in:
lib/bolognese/writers/csv_writer.rb

Instance Method Summary collapse

Instance Method Details

#csvObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bolognese/writers/csv_writer.rb', line 6

def csv
  return nil unless valid?

  bib = {
    doi: doi,
    url: url,
    registered: get_iso8601_date(date_registered),
    state: state,
    resource_type_general: types["resourceTypeGeneral"],
    resource_type: types["resourceType"],
    title: parse_attributes(titles, content: "title", first: true),
    author: authors_as_string(creators),
    publisher: publisher["name"],
    publication_year: publication_year
  }.values

  CSV.generate { |csv| csv << bib }
end