Class: Imap::Backup::Account::Connection::BackupFolders

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = 
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.


6
7
8
# File 'lib/imap/backup/account/connection/backup_folders.rb', line 6

def 
  @account
end

#clientObject (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

#runObject


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: ).run

  names =
    if .folders&.any?
      .folders.map { |af| af[:name] }
    else
      all_names
    end

  all_names.map do |name|
    backup =
      if .folder_blacklist
        !names.include?(name)
      else
        names.include?(name)
      end
    next if !backup

    Account::Folder.new(.connection, name)
  end.compact
end