Module: Rack::Handler

Defined in:
lib/rack/handler/coap.rb,
lib/rack/handler/david.rb,
lib/david/guerilla/rack/handler.rb

Defined Under Namespace

Classes: David

Constant Summary collapse

CoAP =
David

Class Method Summary collapse

Class Method Details

.default(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/david/guerilla/rack/handler.rb', line 5

def self.default(options = {})
  # Guess.
  if ENV.include?("PHP_FCGI_CHILDREN")
    # We already speak FastCGI
    options.delete :File
    options.delete :Port
    Rack::Handler::FastCGI
  elsif ENV.include?("REQUEST_METHOD")
    Rack::Handler::CGI
  elsif ENV.include?("RACK_HANDLER")
    self.get(ENV["RACK_HANDLER"])
  else
    # Return David as handler unless Rails is loaded and config.coap.only
    # is set to false.
    return Rack::Handler::David unless rails_coap_only

    # Original Rack handler order.
    pick ['thin', 'puma', 'webrick']
  end
end