Method: Workers::Import#perform

Defined in:
workers/import.rb

#perform(params) ⇒ Object

Processes an import job.

Parameters:

  • params (Hash{String => Object})

    The JSON deserialized params for the job.

Raises:

  • (ArgumentError)

    The params could not be validated or coerced.



60
61
62
63
64
65
66
67
68
69
70
71
# File 'workers/import.rb', line 60

def perform(params)
  kwargs = validate(params)

  type = kwargs[:type]
  path = kwargs[:path]

  importer = IMPORT_TYPES.fetch(type) do
    raise(NotImplementedError,"unsupported import type: #{type.inspect}")
  end

  importer.import_file(path)
end