Class: Imap::Backup::Uploader
- Inherits:
-
Object
- Object
- Imap::Backup::Uploader
- Defined in:
- lib/imap/backup/uploader.rb
Overview
Uploads a backed-up folder
Instance Method Summary collapse
-
#initialize(folder, serializer) ⇒ Uploader
constructor
A new instance of Uploader.
-
#run ⇒ void
Uploads messages that are present in the backup, but not in the online folder.
Constructor Details
#initialize(folder, serializer) ⇒ Uploader
Returns a new instance of Uploader.
12 13 14 15 |
# File 'lib/imap/backup/uploader.rb', line 12 def initialize(folder, serializer) @folder = folder @serializer = serializer end |
Instance Method Details
#run ⇒ void
This method returns an undefined value.
Uploads messages that are present in the backup, but not in the online folder
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/imap/backup/uploader.rb', line 19 def run if folder.uids.any? rename_serialized_folder else folder.create serializer.force_uid_validity(folder.uid_validity) end return if count.zero? Logger.logger.debug "[#{folder.name}] #{count} to restore" serializer.(missing_uids).with_index do |, i| , i + 1 end end |