Module: TP2

Defined in:
lib/tp2.rb,
lib/tp2/server.rb,
lib/tp2/version.rb,
lib/tp2/rack_adapter.rb,
lib/tp2/http1_adapter.rb

Defined Under Namespace

Modules: RackAdapter Classes: HTTP1Adapter, Server

Constant Summary collapse

(
  "\n" +
  "         ooo\n" +
  "       oo\n" +
  "     o\n" +
  "   \\|/    TP2 - a modern web server for Ruby apps\n" +
  "   / \\       \n" +
  "  /   \\      https://github.com/noteflakes/tp2\n" +
  "⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺\n"
)
VERSION =
'0.7.1'

Class Method Summary collapse

Class Method Details

.config(opts = nil, &app) ⇒ Object



38
39
40
41
42
43
# File 'lib/tp2.rb', line 38

def config(opts = nil, &app)
  return @config if !opts && !app
    
  @config = opts || {}
  @config[:app] = app if app
end

.run(opts = nil, &app) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/tp2.rb', line 21

def run(opts = nil, &app)
  return if @in_run

  opts ||= @config || {}
  begin
    @in_run = true
    machine = UM.new
    server = Server.new(machine, opts, &app)

    setup_signal_handling(machine)

    server.run
  ensure
    @in_run = false
  end
end