Sha256: 0a4a6bfa71d162e3f786062a25a98c39b02a12bdcc8053e4813e3526ac05f3c0

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

# encoding: utf-8

module Imap::Backup
  module Configuration; end

  class Configuration::List
    attr_reader :accounts

    def initialize(accounts = nil)
      if not Configuration::Store.exist?
        raise ConfigurationNotFound.new("Configuration file '#{Configuration::Store.default_pathname}' not found")
      end
      @config = 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 = Account::Connection.new(account)
        yield connection
        connection.disconnect
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imap-backup-1.0.10 lib/imap/backup/configuration/list.rb