Class: Imap::Backup::Serializer::Version2Migrator
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::Version2Migrator
- Defined in:
- lib/imap/backup/serializer/version2_migrator.rb
Instance Attribute Summary collapse
-
#folder_path ⇒ Object
readonly
Returns the value of attribute folder_path.
Instance Method Summary collapse
-
#initialize(folder_path) ⇒ Version2Migrator
constructor
A new instance of Version2Migrator.
- #required? ⇒ Boolean
- #run ⇒ Object
Constructor Details
#initialize(folder_path) ⇒ Version2Migrator
Returns a new instance of Version2Migrator.
9 10 11 |
# File 'lib/imap/backup/serializer/version2_migrator.rb', line 9 def initialize(folder_path) @folder_path = folder_path end |
Instance Attribute Details
#folder_path ⇒ Object (readonly)
Returns the value of attribute folder_path.
7 8 9 |
# File 'lib/imap/backup/serializer/version2_migrator.rb', line 7 def folder_path @folder_path end |
Instance Method Details
#required? ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/imap/backup/serializer/version2_migrator.rb', line 13 def required? return false if !mbox_exists? return false if !imap_exists? return false if !imap_data return false if imap_data[:version] != 2 return false if !imap_data[:uid_validity] return false if !uids.is_a?(Array) true end |
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/imap/backup/serializer/version2_migrator.rb', line 24 def run return false if !required? = return false if ! imap.delete imap.uid_validity = imap_data[:uid_validity] .map { |m| imap.append(m[:uid], m[:length]) } true end |