Module: Rack::Handler::Soba

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

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :debug => false,
}

Class Method Summary collapse

Class Method Details

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

Yields:

  • (server)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rack/handler/soba.rb', line 12

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

  host, port = options[:Host], options[:Port]

  server = ::Soba::Server.new(app, host: host, port: port, **options)

  yield server if block_given?
  begin
    server.run
  rescue Interrupt
    puts "* Stopping..."
    # server.stop
    puts "* Cool!"
  end
end

.valid_optionsObject



29
30
31
32
33
34
35
# File 'lib/rack/handler/soba.rb', line 29

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