Class: Imap::Backup::Account::LocalOnlyFolderDeleter
- Inherits:
-
Object
- Object
- Imap::Backup::Account::LocalOnlyFolderDeleter
- Defined in:
- lib/imap/backup/account/local_only_folder_deleter.rb
Overview
Deletes serialized folders that are not configured to be backed up
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
Instance Method Summary collapse
-
#initialize(account:) ⇒ LocalOnlyFolderDeleter
constructor
A new instance of LocalOnlyFolderDeleter.
- #run ⇒ Object
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 = account end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
11 12 13 |
# File 'lib/imap/backup/account/local_only_folder_deleter.rb', line 11 def account @account end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/imap/backup/account/local_only_folder_deleter.rb', line 17 def run backup_folders = Account::BackupFolders.new( client: account.client, account: account ) wanted = backup_folders.map(&:name) serialized_folders = Account::SerializedFolders.new(account: account) serialized_folders.each do |serializer, _folder| serializer.delete if !wanted.include?(serializer.folder) end end |