Sha256: 441e995373d21713ce428491589a46f939d7040f2b605dd73bc78bd76c9c67e5

Contents?: true

Size: 609 Bytes

Versions: 9

Compression:

Stored size: 609 Bytes

Contents

module Restspec
  module Docs
    class TemplateContext
      def namespace_store
        Restspec::NamespaceStore
      end

      def endpoints_store
        Restspec::EndpointStore
      end

      def schema_store
        Restspec::SchemaStore
      end

      def json_example(schema)
        sample = Restspec::Schema::SchemaExample.new(schema).value
        JSON.pretty_generate(sample).gsub(/^/, '  ')
      end

      def json_example_code(schema)
        "<div class=\"highlight highlight-json\">
          <pre><code>#{json_example(schema)}</pre></code>
        </div>"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
restspec-0.3.2 lib/restspec/runners/docs/template_context.rb
restspec-0.3.1 lib/restspec/runners/docs/template_context.rb
restspec-0.3.0 lib/restspec/runners/docs/template_context.rb
restspec-0.2.6 lib/restspec/runners/docs/template_context.rb
restspec-0.2.5 lib/restspec/runners/docs/template_context.rb
restspec-0.2.4 lib/restspec/runners/docs/template_context.rb
restspec-0.2.3 lib/restspec/runners/docs/template_context.rb
restspec-0.2.2 lib/restspec/runners/docs/template_context.rb
restspec-0.2.1 lib/restspec/runners/docs/template_context.rb