Class: Imap::Backup::Serializer::MessageEnumerator
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::MessageEnumerator
- Defined in:
- lib/imap/backup/serializer/message_enumerator.rb
Overview
Enumerates over a list of stores messages
Instance Method Summary collapse
-
#initialize(imap:) ⇒ MessageEnumerator
constructor
A new instance of MessageEnumerator.
-
#run(uids:) {|message| ... } ⇒ void
Enumerates over the messages.
Constructor Details
#initialize(imap:) ⇒ MessageEnumerator
Returns a new instance of MessageEnumerator.
9 10 11 |
# File 'lib/imap/backup/serializer/message_enumerator.rb', line 9 def initialize(imap:) @imap = imap end |
Instance Method Details
#run(uids:) {|message| ... } ⇒ void
This method returns an undefined value.
Enumerates over the messages
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/imap/backup/serializer/message_enumerator.rb', line 17 def run(uids:, &block) uids.each do |uid_maybe_string| uid = uid_maybe_string.to_i = imap.get(uid) next if ! block.call() end end |