Class: Adelnor::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/adelnor/server.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rack_app, port, options = {}) ⇒ Server

Returns a new instance of Server.



11
12
13
14
15
# File 'lib/adelnor/server.rb', line 11

def initialize(rack_app, port, options = {})
  @rack_app = rack_app
  @port     = port
  @options  = options
end

Class Method Details

.run(*args) ⇒ Object



17
18
19
# File 'lib/adelnor/server.rb', line 17

def self.run(*args)
  new(*args).run
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/adelnor/server.rb', line 21

def run
  handler_klass = if @options[:thread_pool]
                    ThreadedServer
                  elsif @options[:workers]
                    ClusteredServer
                  # elsif @options[:ractors]
                  #  RactorServer
                  elsif @options[:async]
                    AsyncServer
                  else
                    BaseServer
                  end

  handler_klass.run(@rack_app, @port, @options)
end