Sha256: ef8aed8effb12cb9ef260255e9201e86a11a67b4a7558d0d9ce8df7d2a3934e2

Contents?: true

Size: 468 Bytes

Versions: 3

Compression:

Stored size: 468 Bytes

Contents

# encoding: utf-8
require 'rubygems' if RUBY_VERSION < '1.9'
require 'json'

module Imap
  module Backup
    class Downloader
      def initialize(folder, serializer)
        @folder, @serializer = folder, serializer
      end

      def run
        uids = @folder.uids - @serializer.uids
        uids.each do |uid|
          message = @folder.fetch(uid)
          next if message.nil?
          @serializer.save(uid, message)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
imap-backup-1.0.5 lib/imap/backup/downloader.rb
imap-backup-1.0.4 lib/imap/backup/downloader.rb
imap-backup-1.0.3 lib/imap/backup/downloader.rb