Class: Sake::Server::Handler

Inherits:
Mongrel::HttpHandler
  • Object
show all
Defined in:
lib/server.rb

Instance Method Summary collapse

Instance Method Details

#process(request, response) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/server.rb', line 30

def process(request, response)
  uri    = request.params['PATH_INFO'].sub(/^\//, '')
  status = uri.empty? ? 200 : 404
  body   = status == 200 ? Store.to_ruby : 'Not Found' 

  response.start(status) do |headers, output|
    headers['Content-Type'] = 'text/plain'
    output.write body
  end
end