Sha256: 1ad3fca608e69fc5c78760380cddb274d9ed301c75988176ac42f90eb21109a3
Contents?: true
Size: 974 Bytes
Versions: 3
Compression:
Stored size: 974 Bytes
Contents
require 'rack/request' require 'useless/doc/ui/godel' module Useless module Doc class Rack # +Doc::Rack::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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
useless-doc-0.4.0 | lib/useless/doc/rack/ui.rb |
useless-doc-0.3.1 | lib/useless/doc/rack/ui.rb |
useless-doc-0.3.0 | lib/useless/doc/rack/ui.rb |