module Useless module Doc module Rack # +Doc::Rack::Stylesheet+ serves the stylesheet for the current +Doc::UI+ # iff the request path is '/doc.css'. Otherwise, it passes the request # through. # class Stylesheet def initialize(app) @app = app end def call(env) unless env['useless.doc.ui'] raise 'No UI specified.' end if env["PATH_INFO"].to_s == '/doc.css' [200, {'Content-Type' => 'text/css'}, [env['useless.doc.ui'].css]] else @app.call(env) end end end end end end