Sha256: fad98a3cec5945070ce8b2a50bb866c8a50ceb0b54edec27a06bc8ebd334c9f7

Contents?: true

Size: 963 Bytes

Versions: 5

Compression:

Stored size: 963 Bytes

Contents

module DispatchRider
  class Configuration
    attr_accessor :handler_path, :error_handler, :queue_info, :queue_kind, :subscriber, :logger
    attr_reader :callbacks

    def initialize
      @handler_path = Dir.getwd + "/app/handlers"
      @error_handler = DispatchRider::DefaultErrorHandler
      @queue_kind = :file_system
      @queue_info = { path: "tmp/dispatch-rider-queue" }
      @callbacks = Callbacks::Storage.new
      @subscriber = DispatchRider::Subscriber
      @logger = Logger.new(STDERR)
    end

    delegate :before, :after, :around, :to => :callbacks

    def handlers
      @handlers ||= begin
                      load_handler_files
                      DispatchRider::Handlers::Base.subclasses.map{ |klass| klass.name.underscore.to_sym }
                    end
    end

    private

    def load_handler_files
      Dir["#{@handler_path}/*.rb"].each do |filename|
        require filename.gsub(/\.rb$/, '')
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dispatch-rider-1.0.3 lib/dispatch-rider/configuration.rb
dispatch-rider-1.0.2 lib/dispatch-rider/configuration.rb
dispatch-rider-1.0.1 lib/dispatch-rider/configuration.rb
dispatch-rider-1.0.0 lib/dispatch-rider/configuration.rb
dispatch-rider-0.2.7 lib/dispatch-rider/configuration.rb