Class Method Details

.run(app, options = {}) {|server| ... } ⇒ Object

# File 'lib/rack/handler/mongrel.rb', line 9defself.run(app,options={})server=::Mongrel::HttpServer.new(options[:Host]||'0.0.0.0',options[:Port]||8080,options[:num_processors]||950,options[:throttle]||0,options[:timeout]||60)# Acts like Rack::URLMap, utilizing Mongrel's own path finding methods.
# Use is similar to #run, replacing the app argument with a hash of
# { path=>app, ... } or an instance of Rack::URLMap.
ifoptions[:map]ifapp.is_a?Hashapp.eachdo|path,appl|path='/'+pathunlesspath[0]==?/server.register(path,Rack::Handler::Mongrel.new(appl))endelsifapp.is_a?URLMapapp.instance_variable_get(:@mapping).eachdo|(host,path,appl)|nextif!host.nil?&&!options[:Host].nil?&&options[:Host]!=hostpath='/'+pathunlesspath[0]==?/server.register(path,Rack::Handler::Mongrel.new(appl))endelseraiseArgumentError,"first argument should be a Hash or URLMap"endelseserver.register('/',Rack::Handler::Mongrel.new(app))endyieldserverifblock_given?server.run.joinend