Class: ImportJob

Inherits:
Struct
  • Object
show all
Defined in:
app/jobs/import_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filenameObject

Returns the value of attribute filename

Returns:

  • (Object)

    the current value of filename



3
4
5
# File 'app/jobs/import_job.rb', line 3

def filename
  @filename
end

#importObject

Returns the value of attribute import

Returns:

  • (Object)

    the current value of import



3
4
5
# File 'app/jobs/import_job.rb', line 3

def import
  @import
end

#namespaceObject

Returns the value of attribute namespace

Returns:

  • (Object)

    the current value of namespace



3
4
5
# File 'app/jobs/import_job.rb', line 3

def namespace
  @namespace
end

#publishObject

Returns the value of attribute publish

Returns:

  • (Object)

    the current value of publish



3
4
5
# File 'app/jobs/import_job.rb', line 3

def publish
  @publish
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



3
4
5
# File 'app/jobs/import_job.rb', line 3

def user
  @user
end

Instance Method Details

#error(job, exception) ⇒ Object



16
17
18
# File 'app/jobs/import_job.rb', line 16

def error(job, exception)
  import.fail!(exception)
end

#performObject



4
5
6
7
8
9
10
# File 'app/jobs/import_job.rb', line 4

def perform
  strio = StringIO.new

  importer = Iqvoc::SkosImporter.new(filename, namespace, Logger.new(strio), publish)
  importer.run
  @messages = strio.string
end

#success(job) ⇒ Object



12
13
14
# File 'app/jobs/import_job.rb', line 12

def success(job)
  import.finish!(@messages)
end