Sha256: 3506ab81525fb1a31621797dc3d7fdcaf1fbfa45e979aaf6813521d75c4275cc

Contents?: true

Size: 689 Bytes

Versions: 3

Compression:

Stored size: 689 Bytes

Contents

require 'logger'
require 'ns-options'
require 'inbox-sync/config/imap_config'
require 'inbox-sync/config/smtp_config'

module InboxSync

  class Config
    include NsOptions::Proxy

    opt :source, IMAPConfig, :required => true, :default => {}
    opt :dest,   IMAPConfig, :required => true, :default => {}
    opt :notify, SMTPConfig, :required => true, :default => {}

    opt :archive_folder, :default => 'Archived'
    opt :logger, Logger, :required => true, :default => STDOUT

    def validate!
      if !required_set?
        raise ArgumentError, "some required configs are missing"
      end

      source.validate!
      dest.validate!
      notify.validate!
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inbox-sync-0.2.1 lib/inbox-sync/config.rb
inbox-sync-0.2.0 lib/inbox-sync/config.rb
inbox-sync-0.1.0 lib/inbox-sync/config.rb