Class: Webmachine::Adapters::Hatetepe
Defined Under Namespace
Classes: Body
Instance Attribute Summary
#configuration, #dispatcher
Instance Method Summary
collapse
#initialize, run
Instance Method Details
#call(request, &respond) ⇒ Object
37
38
39
40
41
42
|
# File 'lib/webmachine/adapters/hatetepe.rb', line 37
def call(request, &respond)
response = Webmachine::Response.new
dispatcher.dispatch(convert_request(request), response)
respond.call(convert_response(response))
end
|
#options ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/webmachine/adapters/hatetepe.rb', line 17
def options
{
:host => configuration.ip,
:port => configuration.port,
:app => [
::Hatetepe::Server::Pipeline,
::Hatetepe::Server::KeepAlive,
method(:call)
]
}
end
|
#run ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/webmachine/adapters/hatetepe.rb', line 29
def run
EM.epoll
EM.synchrony do
::Hatetepe::Server.start(options)
trap("INT") { EM.stop }
end
end
|