Class: RSpec::RfcHelper::JsonRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/rfc_helper/json_renderer.rb

Overview

Markdown renderer for specs

Instance Method Summary collapse

Constructor Details

#initialize(specs) ⇒ JsonRenderer

Returns a new instance of JsonRenderer.

Parameters:



10
11
12
# File 'lib/rspec/rfc_helper/json_renderer.rb', line 10

def initialize(specs)
  @specs = specs
end

Instance Method Details

#renderString

Generates a report in JSON format.

Returns:

  • (String)


18
19
20
21
22
23
24
25
26
27
# File 'lib/rspec/rfc_helper/json_renderer.rb', line 18

def render
  json = {
    name:     @specs.name,
    url:      @specs.specs_url,
    specs:    specs,
    sections: sections,
  }

  JSON.pretty_generate json
end