Parent

Methods

Rack::Lobster

Paste has a Pony, Rack has a Lobster!

Public Instance Methods

call(env) click to toggle source
# File lib/rack/lobster.rb, line 32
def call(env)
  req = Request.new(env)
  if req.GET["flip"] == "left"
    lobster = LobsterString.split("\n").
      map { |line| line.ljust(42).reverse }.
      join("\n")
    href = "?flip=right"
  elsif req.GET["flip"] == "crash"
    raise "Lobster crashed"
  else
    lobster = LobsterString
    href = "?flip=left"
  end

  res = Response.new
  res.write "<title>Lobstericious!</title>"
  res.write "<pre>"
  res.write lobster
  res.write "</pre>"
  res.write "<p><a href='#{href}'>flip!</a></p>"
  res.write "<p><a href='?flip=crash'>crash!</a></p>"
  res.finish
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.