Class: ChoreWeb

Inherits:
EventMachine::Connection
  • Object
show all
Includes:
EventMachine::HttpServer
Defined in:
lib/chore/server.rb

Overview

A basic webserver that provides a single web page with chore statues

Instance Method Summary collapse

Instance Method Details

#process_http_requestObject



64
65
66
67
68
69
70
71
72
73
# File 'lib/chore/server.rb', line 64

def process_http_request
  resp = EventMachine::DelegatedHttpResponse.new(self)
  filepath = File.dirname(__FILE__) + '/../../views/status.rhtml' 
  markup = File.open(filepath).read
  html = ERB.new(markup).result

  resp.status = 200
  resp.content = html
  resp.send_response
end