Sha256: 4d92cc87199bb40e43539c23ecee02d3983d10830f2c5de4a8766bc42112f5a9
Contents?: true
Size: 564 Bytes
Versions: 4
Compression:
Stored size: 564 Bytes
Contents
class ReportApp def url "http://localhost:#{port}" end def port 1212 end def start Rack::Handler::Thin.run(self, :Port => port) rescue => ex puts $!, $@ end def results @results ||= [] end def call(env) r = Rack::Request.new(env) if r.post? results << JSON.parse(r.body.read) elsif r.get? case r.path when "/results" return [200, {}, [results.to_json]] when "/clear" results.clear else return [404, {}, []] end end [200, {}, []] end end
Version data entries
4 entries across 4 versions & 1 rubygems