Sha256: e10338ad2905470bc0fc13127a86387be7768523dbb464a81119f24eea272bfa

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

class Server
	
	def call(env)
		
		parms = Rack::Request.new(env).params.merge(env["rack.routing_args"]).inject({}){|acc,(k,v)| acc[k.to_sym] = v; acc}
		server = parms[:server]
		
		output = "<html><body><h1>" << server << "</h1><ul>"
		CityWatch.redis.zrevrange("#{CityWatch.config[:prefix]}::#{server}::raw_stats",0,100).each do |update|
			output << "<li><pre>" << update << "</pre></li>"
		end
		output << "</ul></body></html>"
		
		[200,{"Content-Type" => "text/html"},[output]]
	end
	
	Routes.add_route new, { :request_method => 'GET', :path_info => %r{^/(?<server>[\w]+)$} }, {}, :server
	
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
city-watch-0.3.3 lib/city_watch/commander/server.rb