Class: RspecApiDocumentation::Writers::AppendJsonWriter
- Inherits:
-
JsonWriter
show all
- Defined in:
- lib/rspec_api_documentation/writers/append_json_writer.rb
Instance Attribute Summary
Attributes inherited from Writer
#configuration, #index
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from JSONWriter
#write_examples
Methods inherited from Writer
#initialize, write
Class Method Details
.clear_docs(docs_dir) ⇒ Object
17
18
19
|
# File 'lib/rspec_api_documentation/writers/append_json_writer.rb', line 17
def self.clear_docs(docs_dir)
nil end
|
Instance Method Details
#write ⇒ Object
6
7
8
9
10
11
12
13
14
15
|
# 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
|