Module: Rack::Handler::Pronghorn

Defined in:
lib/rack/handler/pronghorn.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :Host => '0.0.0.0',
  :Port => 8080,
  :Verbose => false
}

Class Method Summary collapse

Class Method Details

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

Yields:

  • (server)


13
14
15
16
17
18
19
20
21
22
# File 'lib/rack/handler/pronghorn.rb', line 13

def self.run(app, options = {})
  options  = DEFAULT_OPTIONS.merge(options)

  if options[:Verbose]
    app = Rack::CommonLogger.new(app, STDOUT)
  end
  server = ::Pronghorn::Server.new(app)
  yield server if block_given?
  server.start(options[:Host], options[:Port])
end

.valid_optionsObject



24
25
26
27
28
29
# File 'lib/rack/handler/pronghorn.rb', line 24

def self.valid_options
  {
    "Host=HOST"       => "Hostname to listen on (default: localhost)",
    "Port=PORT"       => "Port to listen on (default: 8080)"
  }
end