Class: Restspec::Docs::TemplateContext

Inherits:
Object
  • Object
show all
Defined in:
lib/restspec/runners/docs/template_context.rb

Instance Method Summary collapse

Instance Method Details

#endpoints_storeObject


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_storeObject


4
5
6
# File 'lib/restspec/runners/docs/template_context.rb', line 4

def namespace_store
  Restspec::NamespaceStore
end

#schema_storeObject


12
13
14
# File 'lib/restspec/runners/docs/template_context.rb', line 12

def schema_store
  Restspec::SchemaStore
end