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.



7
8
9
# File 'lib/imap/backup/serializer/message_enumerator.rb', line 7

def initialize(imap:)
  @imap = imap
end

Instance Attribute Details

#imapObject (readonly)

Returns the value of attribute imap.



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

def imap
  @imap
end

Instance Method Details

#run(uids:) ⇒ Object



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

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