Sha256: 8d4c2f2917496701989b2b2d02944853a10828eb4a010c970073657171bee13b

Contents?: true

Size: 557 Bytes

Versions: 7

Compression:

Stored size: 557 Bytes

Contents

# frozen_string_literal: true

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

    def start
      return if @running

      worker = @configuration[:worker]

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

      @running = true
    end

    def stop
      return unless @running

      @pool.stop

      @running = false
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tobox-0.1.6 lib/tobox/application.rb
tobox-0.1.5 lib/tobox/application.rb
tobox-0.1.4 lib/tobox/application.rb
tobox-0.1.3 lib/tobox/application.rb
tobox-0.1.2 lib/tobox/application.rb
tobox-0.1.1 lib/tobox/application.rb
tobox-0.1.0 lib/tobox/application.rb