Sha256: 36cca2de41882b64ac81fa034aca9f72fe14e0fd1bbd7fb21fc5835c027b5a19

Contents?: true

Size: 668 Bytes

Versions: 2

Compression:

Stored size: 668 Bytes

Contents

# encoding: utf-8

module Imap
  module Backup
    module Configuration
      class List

      attr_reader :accounts

      def initialize(accounts = nil)
        @config = Imap::Backup::Configuration::Store.new

        if accounts.nil?
          @accounts = @config.data[:accounts]
        else
          @accounts = @config.data[:accounts].select{ |account| accounts.include?(account[:username]) }
        end
      end

      def each_connection
        @accounts.each do |account|
          connection = Imap::Backup::Account::Connection.new(account)
          yield connection
          connection.disconnect
        end
      end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
imap-backup-0.0.5 lib/imap/backup/configuration/list.rb
imap-backup-0.0.4 lib/imap/backup/configuration/list.rb