Class: Imap::Backup::Account::LocalOnlyFolderDeleter

Inherits:
Object
  • Object
show all
Defined in:
lib/imap/backup/account/local_only_folder_deleter.rb

Overview

Deletes serialized folders that are not configured to be backed up. This is used in mirror mode, where local copies are only kept as long as they exist on the server.

Instance Method Summary collapse

Constructor Details

#initialize(account:) ⇒ LocalOnlyFolderDeleter

Returns a new instance of LocalOnlyFolderDeleter.



13
14
15
# File 'lib/imap/backup/account/local_only_folder_deleter.rb', line 13

def initialize(account:)
  @account = 
end

Instance Method Details

#runvoid

This method returns an undefined value.

Runs the deletion operation



19
20
21
22
23
24
25
26
27
28
# File 'lib/imap/backup/account/local_only_folder_deleter.rb', line 19

def run
  backup_folders = Account::BackupFolders.new(
    client: .client, account: 
  )
  wanted = backup_folders.map(&:name)
  serialized_folders = Account::SerializedFolders.new(account: )
  serialized_folders.each_key do |serializer|
    serializer.delete if !wanted.include?(serializer.folder)
  end
end