module Shrine::Plugins::Backup::AttacherMethods

  1. lib/shrine/plugins/backup.rb

Methods

Public Instance

  1. backup_file
  2. destroy
  3. promote
  4. replace

Public Instance methods

backup_file (uploaded_file)

Returns a copy of the given uploaded file with storage changed to backup storage.

[show source]
# File lib/shrine/plugins/backup.rb, line 57
def backup_file(uploaded_file)
  uploaded_file(uploaded_file.to_json) do |file|
    file.data["storage"] = backup_storage.to_s
  end
end
destroy ()

Deletes the backup file in addition to the stored file.

[show source]
# File lib/shrine/plugins/backup.rb, line 49
def destroy
  result = super
  delete_backup!(get) if result && delete_backup?
  result
end
promote (*)

Backs up the stored file after promoting.

[show source]
# File lib/shrine/plugins/backup.rb, line 35
def promote(*)
  result = super
  store_backup!(result) if result
  result
end
replace ()

Deletes the backup file in addition to the stored file.

[show source]
# File lib/shrine/plugins/backup.rb, line 42
def replace
  result = super
  delete_backup!(@old) if result && delete_backup?
  result
end