Class: Imap::Backup::Account::SerializedFolders
- Inherits:
-
Object
- Object
- Imap::Backup::Account::SerializedFolders
- Includes:
- Enumerable
- Defined in:
- lib/imap/backup/account/serialized_folders.rb
Overview
Enumerates over an account’s backed-up folders
Instance Method Summary collapse
-
#each {|serializer, folder| ... } ⇒ void
Runs the enumeration over local serializers and remote folders.
-
#each_key {|serializer| ... } ⇒ void
Runs the enumeration over each local serializer.
-
#each_value {|folder| ... } ⇒ void
Runs the enumeration over each remote folder.
-
#initialize(account:) ⇒ SerializedFolders
constructor
A new instance of SerializedFolders.
Constructor Details
#initialize(account:) ⇒ SerializedFolders
Returns a new instance of SerializedFolders.
16 17 18 |
# File 'lib/imap/backup/account/serialized_folders.rb', line 16 def initialize(account:) @account = account end |
Instance Method Details
#each {|serializer, folder| ... } ⇒ void
This method returns an undefined value.
Runs the enumeration over local serializers and remote folders
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/imap/backup/account/serialized_folders.rb', line 24 def each(&block) return enum_for(:each) if !block glob.each do |path| name = path.relative_path_from(base).to_s[0..-6] serializer = Serializer.new(account.local_path, name) folder = Account::Folder.new(account.client, name) block.call(serializer, folder) end end |
#each_key {|serializer| ... } ⇒ void
This method returns an undefined value.
Runs the enumeration over each local serializer
38 39 40 41 42 43 44 45 46 |
# File 'lib/imap/backup/account/serialized_folders.rb', line 38 def each_key(&block) return enum_for(:each_key) if !block glob.each do |path| name = path.relative_path_from(base).to_s[0..-6] serializer = Serializer.new(account.local_path, name) block.call(serializer) end end |
#each_value {|folder| ... } ⇒ void
This method returns an undefined value.
Runs the enumeration over each remote folder
51 52 53 54 55 56 57 58 59 |
# File 'lib/imap/backup/account/serialized_folders.rb', line 51 def each_value(&block) return enum_for(:each_value) if !block glob.each do |path| name = path.relative_path_from(base).to_s[0..-6] folder = Account::Folder.new(account.client, name) block.call(folder) end end |