Class: Rack::JsonSchema::Docs
- Inherits:
-
Object
- Object
- Rack::JsonSchema::Docs
- Defined in:
- lib/rack/json_schema/docs.rb
Defined Under Namespace
Classes: DocumentGenerator
Constant Summary collapse
- DEFAULT_PATH =
"/docs"
Instance Method Summary collapse
-
#call(env) ⇒ Object
Returns rendered document for document request.
-
#initialize(app, path: nil, schema: nil) ⇒ Docs
constructor
Behaves as a rack-middleware.
Constructor Details
#initialize(app, path: nil, schema: nil) ⇒ Docs
Behaves as a rack-middleware
10 11 12 13 14 15 |
# 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 |
Instance Method Details
#call(env) ⇒ Object
Returns rendered document for document request
19 20 21 22 23 24 25 26 27 |
# 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 |