Module: Rack::Handler

Defined in:
lib/gems/rack-0.9.1/lib/rack/handler.rb,
lib/gems/rack-0.9.1/lib/rack/handler/cgi.rb,
lib/gems/rack-0.9.1/lib/rack/handler/lsws.rb,
lib/gems/rack-0.9.1/lib/rack/handler/scgi.rb,
lib/gems/rack-0.9.1/lib/rack/handler/thin.rb,
lib/gems/rack-0.9.1/lib/rack/handler/fastcgi.rb,
lib/gems/rack-0.9.1/lib/rack/handler/mongrel.rb,
lib/gems/rack-0.9.1/lib/rack/handler/webrick.rb,
lib/gems/rack-0.9.1/lib/rack/handler/evented_mongrel.rb,
lib/gems/rack-0.9.1/lib/rack/handler/swiftiplied_mongrel.rb

Overview

Handlers connect web servers with Rack.

Rack includes Handlers for Mongrel, WEBrick, FastCGI, CGI, SCGI and LiteSpeed.

Handlers usually are activated by calling MyHandler.run(myapp). A second optional hash can be passed to include server-specific configuration.

Defined Under Namespace

Classes: CGI, EventedMongrel, FastCGI, LSWS, Mongrel, SCGI, SwiftipliedMongrel, Thin, WEBrick

Class Method Summary collapse

Class Method Details

.get(server) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gems/rack-0.9.1/lib/rack/handler.rb', line 11

def self.get(server)
  return unless server

  if klass = @handlers[server]
    obj = Object
    klass.split("::").each { |x| obj = obj.const_get(x) }
    obj
  else
    Rack::Handler.const_get(server.capitalize)
  end
end

.register(server, klass) ⇒ Object



23
24
25
26
# File 'lib/gems/rack-0.9.1/lib/rack/handler.rb', line 23

def self.register(server, klass)
  @handlers ||= {}
  @handlers[server] = klass
end