require 'rubygems' require 'backports' require 'rack' require 'mongrel' class Mise def initialize(port) @port = port end def call(env) req = if req.params.has_key?('start') # start the new server and tell the requester when it's running {['port']) } return [200, {"Content-Type" => "text/html"}, "New server started"] else html = <<-HTML Mise en abyme

served from an entity on port #{@port} | descend into the abyss

HTML return [200, {"Content-Type" => "text/html"}, html] end end end class Runner attr_accessor :port def initialize(port) @port = port warn "Server started on port #{@port}", :Port => @port) end end puts "Use a browser to go to http://localhost:9292/"