Class: Spina::Admin::Conferences::ImportJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/spina/admin/conferences/import_job.rb

Overview

Job for importing CSV files.

Direct Known Subclasses

DelegateImportJob, PresentationImportJob

Instance Method Summary collapse

Instance Method Details

#import(file) {|row| ... } ⇒ Object

Performs the job.

Parameters:

  • file (String)

    the UTF-8-encoded string to parse as a CSV

Yield Parameters:

  • row (Hash)

    the current row of the CSV



19
20
21
22
# File 'app/jobs/spina/admin/conferences/import_job.rb', line 19

def import(file)
  csv_rows = CSV.parse file, encoding: 'UTF-8', headers: true, header_converters: :symbol, converters: [:json]
  csv_rows.each { |row| yield(row) }
end