Sha256: 0512878d8a7cfe16dd80b01bfe184c6e0aab4a59eecbc6fee14d1e55fa525810

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

module Tobox
  class Application
    def initialize(configuration)
      @configuration = configuration
      @running = false

      worker = @configuration[:worker]

      @pool = case worker
              when :thread then ThreadedPool
              when :fiber then FiberPool
              else worker
              end.new(@configuration)
    end

    def start
      return if @running

      @pool.start
      @running = true
    end

    def stop
      return unless @running

      @pool.stop

      @running = false
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tobox-0.3.2 lib/tobox/application.rb
tobox-0.3.1 lib/tobox/application.rb
tobox-0.3.0 lib/tobox/application.rb
tobox-0.2.0 lib/tobox/application.rb