Class: Imap::Backup::Serializer::IntegrityChecker
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::IntegrityChecker
- Defined in:
- lib/imap/backup/serializer/integrity_checker.rb
Instance Attribute Summary collapse
-
#imap ⇒ Object
readonly
Returns the value of attribute imap.
-
#mbox ⇒ Object
readonly
Returns the value of attribute mbox.
Instance Method Summary collapse
-
#initialize(imap:, mbox:) ⇒ IntegrityChecker
constructor
A new instance of IntegrityChecker.
- #run ⇒ Object
Constructor Details
#initialize(imap:, mbox:) ⇒ IntegrityChecker
Returns a new instance of IntegrityChecker.
12 13 14 15 |
# File 'lib/imap/backup/serializer/integrity_checker.rb', line 12 def initialize(imap:, mbox:) @imap = imap @mbox = mbox end |
Instance Attribute Details
#imap ⇒ Object (readonly)
Returns the value of attribute imap.
9 10 11 |
# File 'lib/imap/backup/serializer/integrity_checker.rb', line 9 def imap @imap end |
#mbox ⇒ Object (readonly)
Returns the value of attribute mbox.
10 11 12 |
# File 'lib/imap/backup/serializer/integrity_checker.rb', line 10 def mbox @mbox end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/imap/backup/serializer/integrity_checker.rb', line 17 def run if !imap.valid? = ".imap file '#{imap.pathname}' is corrupt" raise Serializer::FolderIntegrityError, end if !mbox.exist? = ".mbox file '#{mbox.pathname}' is missing" raise Serializer::FolderIntegrityError, end if imap..empty? if mbox.length.positive? = ".imap file '#{imap.pathname}' lists no messages, " \ "but .mbox file '#{mbox.pathname}' is not empty" raise Serializer::FolderIntegrityError, end return end check_offset_ordering! check_mbox_length! nil end |