Class: Webmachine::Adapters::Hatetepe

Inherits:
Webmachine::Adapter show all
Defined in:
lib/webmachine/adapters/hatetepe.rb

Defined Under Namespace

Classes: Body

Instance Attribute Summary

Attributes inherited from Webmachine::Adapter

#configuration, #dispatcher

Instance Method Summary collapse

Methods inherited from Webmachine::Adapter

#initialize, run

Constructor Details

This class inherits a constructor from Webmachine::Adapter

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

#optionsObject



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

#runObject



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