# File lib/rack/handler/mongrel.rb, line 9
 9:       def self.run(app, options={})
10:         server = ::Mongrel::HttpServer.new(
11:           options[:Host]           || '0.0.0.0',
12:           options[:Port]           || 8080,
13:           options[:num_processors] || 950,
14:           options[:throttle]       || 0,
15:           options[:timeout]        || 60)
16:         # Acts like Rack::URLMap, utilizing Mongrel's own path finding methods.
17:         # Use is similar to #run, replacing the app argument with a hash of
18:         # { path=>app, ... } or an instance of Rack::URLMap.
19:         if options[:map]
20:           if app.is_a? Hash
21:             app.each do |path, appl|
22:               path = '/'+path unless path[0] == ?/
23:               server.register(path, Rack::Handler::Mongrel.new(appl))
24:             end
25:           elsif app.is_a? URLMap
26:             app.instance_variable_get(:@mapping).each do |(host, path, appl)|
27:              next if !host.nil? && !options[:Host].nil? && options[:Host] != host
28:              path = '/'+path unless path[0] == ?/
29:              server.register(path, Rack::Handler::Mongrel.new(appl))
30:             end
31:           else
32:             raise ArgumentError, "first argument should be a Hash or URLMap"
33:           end
34:         else
35:           server.register('/', Rack::Handler::Mongrel.new(app))
36:         end
37:         yield server  if block_given?
38:         server.run.join
39:       end