Sha256: c108298a91ff11219fb6464b344c61b4f3a4c3ad1e16507aee3b98c8ba569acc

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

require 'proletariat/version'

require 'concurrent'
require 'bunny'
require 'logger'
require 'forwardable'

require 'proletariat/concurrency/actor'
require 'proletariat/concurrency/supervisor'

require 'proletariat/util/worker_description_parser'

require 'proletariat/configuration'
require 'proletariat/manager'
require 'proletariat/publisher'
require 'proletariat/queue_config'
require 'proletariat/runner'
require 'proletariat/subscriber'
require 'proletariat/worker'

# Public: Creates the Proletariat namespace and holds a process-wide Runner
#         instance as well as access to the configuration attributes.
module Proletariat
  class << self
    extend Forwardable

    # Public: Delegate lifecycle calls to the process-wide Runner.
    def_delegators :runner, :run, :run!, :stop, :running?, :publish, :purge

    # Public: Allows configuration of Proletariat via given block.
    #
    # block - Block containing configuration calls.
    #
    # Returns nil.
    def configure(&block)
      config.configure_with_block(&block)

      nil
    end

    def runner
      @runner ||= Runner.new
    end

    def method_missing(method_sym, *arguments, &block)
      if config.respond_to? method_sym
        config.send(method_sym, *arguments, &block)
      else
        super
      end
    end

    private

    # Internal: Global configuration object.
    def config
      @config ||= Configuration.new
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
proletariat-0.0.6 lib/proletariat.rb
proletariat-0.0.5 lib/proletariat.rb
proletariat-0.0.4 lib/proletariat.rb