C0 code coverage information
Generated on Sat Feb 02 17:44:24 +0100 2008 with rcov 0.8.1.2
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2 # All files in this distribution are subject to the terms of the Ruby license.
3
4 module Ramaze
5 module Adapter
6
7 # This class is holding common behaviour for its subclasses.
8
9 class Base
10 class << self
11
12 # For the specified host and for all given ports call run_server and
13 # add the returned thread to the Global.adapters ThreadGroup.
14 # Afterwards adds a trap for the value of Global.shutdown_trap which
15 # calls Ramaze.shutdown when triggered (usually by SIGINT).
16
17 def start host, ports
18 ports.each do |port|
19 Global.adapters.add(run_server(host, port))
20 trap(Global.shutdown_trap){ Ramaze.shutdown }
21 end
22 end
23
24 # Does nothing
25
26 def stop
27 Inform.debug("Stopping #{self.class}")
28 end
29
30 # This is called by Rack with the usual env, subsequently calls
31 # ::respond with it.
32 #
33 # The method itself acts just as a wrapper for benchmarking and then
34 # calls .finish on the current response after ::respond has finished.
35
36 def call(env)
37 if Ramaze::Global.benchmarking
38 time = Benchmark.measure{ respond(env) }
39 Inform.debug('request took %.5fs [~%.0f r/s]' % [time.real, 1.0/time.real])
40 else
41 respond env
42 end
43
44 Thread.current[:response].finish
45 end
46
47 # Initializes Request with env and an empty Response. Records the
48 # request into Ramaze::Record if Global.record is true.
49 # Then goes on and calls Dispatcher::handle with request and response.
50
51 def respond env
52 request, response = Request.new(env), Response.new
53 if filter = Global.record
54 Record << request if filter[request]
55 end
56 Dispatcher.handle(request, response)
57 end
58 end
59 end
60 end
61 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.