module Useless module Doc class Proxy # +Doc::Proxy::HTML+ is the base application for +Useless::Doc::Proxy+. # It expects a +Doc::UI+ instance to be set as 'useless.doc.ui', and a # +Doc::Core+ entity to be set as 'useless.doc.subject', and then simply # passes the latter to the former's +#html+ method. # module HTML def self.call(env) if html = env['useless.doc.ui'].html(env['useless.doc.subject']) if env['useless.doc.logger'] env['useless.doc.logger'].info "rendered subject HTML for #{env['useless.doc.url']}" env['useless.doc.logger'].debug "rendered HTML: #{html}" end [200, {'Content-Type' => 'text/html'}, [html]] else [404, {'Content-Type' => 'text/plain'}, ['Could not render documentation.']] end end end end end end