Sha256: 2b92b1ff5fb0782d4eeae20bdd6b51f4eeaf423a7d022e8cb60b45d2c6f60e72
Contents?: true
Size: 960 Bytes
Versions: 1
Compression:
Stored size: 960 Bytes
Contents
require 'em-hiredis' require 'eventmachine_httpserver' require 'evma_httpserver/response' require 'erb' require_relative './helpers' require_relative './chart' module Rstatsd class Server < EventMachine::Connection include EventMachine::HttpServer include Rstatsd::Helpers def post_init super end def process_http_request response = EM::DelegatedHttpResponse.new(self) case @http_request_uri when '/' response.content_type 'text/html' response.content = File.open('templates/index.html').read response.send_response when '/stats' Rstatsd::Chart.new(@http_query_string).draw_chart do |chart| @chart = chart google_chart = ERB.new(File.open('templates/google_chart.erb').read).result(binding) response.content_type 'text/html' response.content = google_chart response.send_response end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rstatsd-0.2 | lib/rstatsd/server.rb |