Class: Imap::Backup::Account::Connection::BackupFolders
- Inherits:
-
Object
- Object
- Imap::Backup::Account::Connection::BackupFolders
- Defined in:
- lib/imap/backup/account/connection/backup_folders.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client:, account:) ⇒ BackupFolders
constructor
A new instance of BackupFolders.
- #run ⇒ Object
Constructor Details
#initialize(client:, account:) ⇒ BackupFolders
Returns a new instance of BackupFolders.
9 10 11 12 |
# File 'lib/imap/backup/account/connection/backup_folders.rb', line 9 def initialize(client:, account:) @client = client @account = account end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
6 7 8 |
# File 'lib/imap/backup/account/connection/backup_folders.rb', line 6 def account @account end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/imap/backup/account/connection/backup_folders.rb', line 7 def client @client end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/imap/backup/account/connection/backup_folders.rb', line 14 def run all_names = Account::Connection::FolderNames.new(client: client, account: account).run names = if account.folders&.any? account.folders.map { |af| af[:name] } else all_names end all_names.map do |name| backup = if account.folder_blacklist !names.include?(name) else names.include?(name) end next if !backup Account::Folder.new(account.connection, name) end.compact end |