Class: Restspec::Docs::TemplateContext
- Inherits:
-
Object
- Object
- Restspec::Docs::TemplateContext
- Defined in:
- lib/restspec/runners/docs/template_context.rb
Instance Method Summary collapse
- #endpoints_store ⇒ Object
- #json_example(schema) ⇒ Object
- #json_example_code(schema) ⇒ Object
- #namespace_store ⇒ Object
- #schema_store ⇒ Object
Instance Method Details
#endpoints_store ⇒ Object
8 9 10 |
# File 'lib/restspec/runners/docs/template_context.rb', line 8 def endpoints_store Restspec::EndpointStore end |
#json_example(schema) ⇒ Object
16 17 18 19 |
# File 'lib/restspec/runners/docs/template_context.rb', line 16 def json_example(schema) sample = Restspec::Schema::SchemaExample.new(schema).value JSON.pretty_generate(sample).gsub(/^/, ' ') end |
#json_example_code(schema) ⇒ Object
21 22 23 24 25 |
# File 'lib/restspec/runners/docs/template_context.rb', line 21 def json_example_code(schema) "<div class=\"highlight highlight-json\"> <pre><code>#{json_example(schema)}</pre></code> </div>" end |
#namespace_store ⇒ Object
4 5 6 |
# File 'lib/restspec/runners/docs/template_context.rb', line 4 def namespace_store Restspec::NamespaceStore end |
#schema_store ⇒ Object
12 13 14 |
# File 'lib/restspec/runners/docs/template_context.rb', line 12 def schema_store Restspec::SchemaStore end |