Class: Imap::Backup::Mirror

Inherits:
Object
  • Object
show all
Defined in:
lib/imap/backup/mirror.rb,
lib/imap/backup/mirror/map.rb

Overview

Synchronises a folder between a source and destination

Defined Under Namespace

Classes: Map

Instance Method Summary collapse

Constructor Details

#initialize(serializer, folder) ⇒ Mirror

Returns a new instance of Mirror.



8
9
10
11
# File 'lib/imap/backup/mirror.rb', line 8

def initialize(serializer, folder)
  @serializer = serializer
  @folder = folder
end

Instance Method Details

#runvoid

This method returns an undefined value.

If necessary, reates the destination folder, then deletes any messages in the destination folder that are not in the local store, sets existing messages’ flas then appends any missing messages and saves the mapping file



20
21
22
23
24
25
26
# File 'lib/imap/backup/mirror.rb', line 20

def run
  ensure_destination_folder
  delete_destination_only_emails
  update_flags
  append_emails
  map.save
end