class RspecApiDocumentation::Writers::JSONWriter
Public Instance Methods
write()
click to toggle source
# File lib/rspec_api_documentation/writers/json_writer.rb, line 8 def write File.open(docs_dir.join("index.json"), "w+") do |f| f.write Formatter.to_json(JSONIndex.new(index, configuration)) end write_examples end
write_examples()
click to toggle source
# File lib/rspec_api_documentation/writers/json_writer.rb, line 15 def write_examples index.examples.each do |example| json_example = JSONExample.new(example, configuration) FileUtils.mkdir_p(docs_dir.join(json_example.dirname)) File.open(docs_dir.join(json_example.dirname, json_example.filename), "w+") do |f| f.write Formatter.to_json(json_example) end end end