Class: Imap::Backup::Serializer::Appender
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::Appender
- Defined in:
- lib/imap/backup/serializer/appender.rb
Instance Attribute Summary collapse
-
#folder ⇒ Object
readonly
Returns the value of attribute folder.
-
#imap ⇒ Object
readonly
Returns the value of attribute imap.
-
#mbox ⇒ Object
readonly
Returns the value of attribute mbox.
Instance Method Summary collapse
-
#initialize(folder:, imap:, mbox:) ⇒ Appender
constructor
A new instance of Appender.
- #run(uid:, message:, flags:) ⇒ Object
Constructor Details
#initialize(folder:, imap:, mbox:) ⇒ Appender
Returns a new instance of Appender.
7 8 9 10 11 |
# File 'lib/imap/backup/serializer/appender.rb', line 7 def initialize(folder:, imap:, mbox:) @folder = folder @imap = imap @mbox = mbox end |
Instance Attribute Details
#folder ⇒ Object (readonly)
Returns the value of attribute folder.
4 5 6 |
# File 'lib/imap/backup/serializer/appender.rb', line 4 def folder @folder end |
#imap ⇒ Object (readonly)
Returns the value of attribute imap.
3 4 5 |
# File 'lib/imap/backup/serializer/appender.rb', line 3 def imap @imap end |
#mbox ⇒ Object (readonly)
Returns the value of attribute mbox.
5 6 7 |
# File 'lib/imap/backup/serializer/appender.rb', line 5 def mbox @mbox end |
Instance Method Details
#run(uid:, message:, flags:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/imap/backup/serializer/appender.rb', line 13 def run(uid:, message:, flags:) raise "Can't add messages without uid_validity" if !imap.uid_validity uid = uid.to_i existing = imap.get(uid) if existing Logger.logger.debug( "[#{folder}] message #{uid} already downloaded - skipping" ) return end do_append uid, , flags end |