class RspecApiDocumentation::Writers::AppendJsonWriter

Public Class Methods

clear_docs(docs_dir) click to toggle source
# File lib/rspec_api_documentation/writers/append_json_writer.rb, line 17
def self.clear_docs(docs_dir)
  nil #noop
end

Public Instance Methods

write() click to toggle source
# File lib/rspec_api_documentation/writers/append_json_writer.rb, line 6
def write
  index_file = docs_dir.join("index.json")
  if File.exists?(index_file) && (output = File.read(index_file)).length >= 2
    existing_index_hash = JSON.parse(output)
  end
  File.open(index_file, "w+") do |f|
    f.write Formatter.to_json(AppendJsonIndex.new(index, configuration, existing_index_hash))
  end
  write_examples
end