class Rack::JsonSchema::Docs
Constants
- DEFAULT_PATH
Public Class Methods
new(app, path: nil, schema: nil)
click to toggle source
Behaves as a rack-middleware @param app [Object] Rack
application @param path [String, nil] URL path to return document (default: /docs) @param schema [Hash] Schema
object written in JSON schema format
# File lib/rack/json_schema/docs.rb, line 10 def initialize(app, path: nil, schema: nil) @app = app @path = path @markdown = Jdoc::Generator.call(schema) @html = Jdoc::Generator.call(schema, html: true) end
Public Instance Methods
call(env)
click to toggle source
Returns rendered document for document request @param env [Hash] Rack
env
# File lib/rack/json_schema/docs.rb, line 19 def call(env) DocumentGenerator.call( app: @app, env: env, html: @html, markdown: @markdown, path: path, ) end
Private Instance Methods
path()
click to toggle source
@return [String] Path to return document
# File lib/rack/json_schema/docs.rb, line 32 def path @path || DEFAULT_PATH end