Sha256: 8c80fd57323cac1170dc4f285b40209cdaef895e76da773e6c73af9d8432502c
Contents?: true
Size: 930 Bytes
Versions: 2
Compression:
Stored size: 930 Bytes
Contents
require "imap/backup/account/folder" module Imap; end module Imap::Backup class Account; end class Account::BackupFolders include Enumerable attr_reader :account attr_reader :client def initialize(client:, account:) @client = client @account = account end def each(&block) return enum_for(:each) if !block all_names = client.list configured = case when account.folders&.any? account.folders.map { |af| af[:name] } when account.folder_blacklist [] else all_names end names = if account.folder_blacklist all_names - configured else all_names & configured end names.each { |name| block.call(Account::Folder.new(client, name)) } end def map(&block) each.map do |folder| block.call(folder) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
imap-backup-13.3.0 | lib/imap/backup/account/backup_folders.rb |
imap-backup-13.2.0 | lib/imap/backup/account/backup_folders.rb |