module Useless module Doc class Proxy # +Doc::Proxy::CSS+ serves the stylesheet for the current +Doc::UI+ # iff the request path is '/doc.css'. Otherwise, it passes the request # down the stack. # class CSS def initialize(app) @app = app end def call(env) if env["PATH_INFO"].to_s == '/doc.css' if env['useless.doc.logger'] env['useless.doc.logger'].info "serving CSS for #{env['useless.doc.ui'].class.name}" end [200, {'Content-Type' => 'text/css'}, [env['useless.doc.ui'].css]] else @app.call(env) end end end end end end