Sha256: c38273a0a919f0b238644ea04b11697e83f7f3e434d02ef67ee523d297ed8224

Contents?: true

Size: 807 Bytes

Versions: 6

Compression:

Stored size: 807 Bytes

Contents

module Imap::Backup
  class Account; end
  class Account::Connection; end

  class Account::Connection::BackupFolders
    attr_reader :account
    attr_reader :client

    def initialize(client:, account:)
      @client = client
      @account = account
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
imap-backup-9.0.1.rc1 lib/imap/backup/account/connection/backup_folders.rb
imap-backup-9.0.0 lib/imap/backup/account/connection/backup_folders.rb
imap-backup-9.0.0.rc1 lib/imap/backup/account/connection/backup_folders.rb
imap-backup-8.0.2 lib/imap/backup/account/connection/backup_folders.rb
imap-backup-8.0.1 lib/imap/backup/account/connection/backup_folders.rb
imap-backup-8.0.0 lib/imap/backup/account/connection/backup_folders.rb