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.



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

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

Instance Attribute Details

#errorObject

Returns the value of attribute error.



20
21
22
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 20

def error
  @error
end

#uploadObject (readonly)

Returns the value of attribute upload.



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

def upload
  @upload
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  error.nil?
end

#to_sObject



31
32
33
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 31

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