Sha256: 9a5616374285079bf1055e1c7c9308e430ccbb77669637b376b59007115fdbb4
Contents?: true
Size: 976 Bytes
Versions: 8
Compression:
Stored size: 976 Bytes
Contents
require 'rack/request' require 'useless/doc/ui/godel' module Useless module Doc class Proxy # +Doc::Proxy::UI+ chooses which UI should be used to render the # documentation and sets it to 'useless.doc.ui'. # # It could theoretically be chosen via the 'ui' parameter, # but until there are other UIs, it will alway choose +UI::Godel+. # class UI def initialize(app) @app = app end def call(env) request = ::Rack::Request.new(env) env['useless.doc.ui'] = case request.params['ui'] when 'godel'; Useless::Doc::UI::Godel.new(env['useless.doc.router']) else Useless::Doc::UI::Godel.new(env['useless.doc.router']) end if env['useless.doc.logger'] env['useless.doc.logger'].debug "selected UI: #{env['useless.doc.ui'].class.name}" end @app.call(env) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems