Class: Imap::Backup::Serializer::MessageEnumerator

Inherits:
Object
  • Object
show all
Defined in:
lib/imap/backup/serializer/message_enumerator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(imap:) ⇒ MessageEnumerator

Returns a new instance of MessageEnumerator.


5
6
7
# File 'lib/imap/backup/serializer/message_enumerator.rb', line 5

def initialize(imap:)
  @imap = imap
end

Instance Attribute Details

#imapObject (readonly)

Returns the value of attribute imap.


3
4
5
# File 'lib/imap/backup/serializer/message_enumerator.rb', line 3

def imap
  @imap
end

Instance Method Details

#run(uids:) ⇒ Object


9
10
11
12
13
14
15
16
17
18
# File 'lib/imap/backup/serializer/message_enumerator.rb', line 9

def run(uids:)
  uids.each do |uid_maybe_string|
    uid = uid_maybe_string.to_i
    message = imap.get(uid)

    next if !message

    yield message
  end
end