Class: ObjectStorage::MigrateUploadsWorker::MigrationResult

Inherits:
Object
  • Object
show all
Defined in:
app/workers/object_storage/migrate_uploads_worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(upload, error = nil) ⇒ MigrationResult

Returns a new instance of MigrationResult.


18
19
20
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 18

def initialize(upload, error = nil)
  @upload, @error = upload, error
end

Instance Attribute Details

#errorObject

Returns the value of attribute error


16
17
18
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 16

def error
  @error
end

#uploadObject (readonly)

Returns the value of attribute upload


15
16
17
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 15

def upload
  @upload
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 22

def success?
  error.nil?
end

#to_sObject


26
27
28
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 26

def to_s
  success? ? _("Migration successful.") : _("Error while migrating %{upload_id}: %{error_message}") % { upload_id: upload.id, error_message: error.message }
end