Sha256: 9ed555fef89c5d15878afd5dd33cc18defe4a46685ad898c505e6cc0b120c32b
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
require 'logger' require 'ns-options' require 'inbox-sync/config/imap_config' require 'inbox-sync/config/smtp_config' require 'inbox-sync/config/filter' 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 opt :filters, :default => [], :required => true opt :max_threads, :default => 1, :required => true def filter(*args, &block) filters << Filter.new(*args, &block) end def validate! if !required_set? raise ArgumentError, "some required configs are missing" end source.validate! dest.validate! notify.validate! end protected def contains(value); /.*#{value}.*/; end def starts_with(value); /\A#{value}.*/; end def ends_with(value); /.*#{value}\Z/; end alias_method :like, :contains alias_method :includes, :contains alias_method :inc, :includes alias_method :sw, :starts_with alias_method :ew, :ends_with end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inbox-sync-0.4.0 | lib/inbox-sync/config.rb |