Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (22 sloc) 0.582 kb
require "pathname"
root = Pathname.new(File.dirname(__FILE__)).join("site")
AJAX = root.join("katz.html")
class SlowPage
def initialize(app)
@app = app
end
def call(env)
if env["PATH_INFO"] == "/index.html"
system "staticmatic build ."
@app.call(env)
elsif env["PATH_INFO"] == "/ajax.html"
sleep 1
[200, {"Content-Type" => "text/html"}, [File.read(AJAX)]]
else
@app.call(env)
end
end
end
use SlowPage
use Rack::Static, :urls => ["/"], :root => root
run proc {|env| [200, {"Content-Type" => "text/html"}, ["Hello world"]]}
Jump to Line
Something went wrong with that request. Please try again.