Method: CdmMigrator::CsvExportService#row_for

Defined in:
app/services/csv_export_service.rb

#row_for(document) ⇒ Array <String>

Returns - the csv row for the given document.

Parameters:

  • - (SolrDocument)

    Any model that has the properties listed in #included_fields (e.g. GenericWork, FileSet)

Returns:

  • (Array <String>)
    • the csv row for the given document



40
41
42
43
44
45
46
47
# File 'app/services/csv_export_service.rb', line 40

def row_for(document)
  line_hash = {}
  line_hash['type'] = document._source[:has_model_ssim].first
  included_fields.each do |field|
    line_hash[field] = create_cell document, field
  end
  line_hash.values_at(*csv_headers).map { |cell| cell.blank? ? '' : cell }
end