lib/ghost_writer.rb in ghost_writer-0.4.1 vs lib/ghost_writer.rb in ghost_writer-0.4.2
- old
+ new
@@ -29,15 +29,17 @@
if output_flag
unless File.exist?(output_path)
FileUtils.mkdir_p(output_path)
end
document_index = GhostWriter::DocumentIndex.new(output_path + "#{DOCUMENT_INDEX_FILENAME}", document_group, GhostWriter.output_format)
- document_index.write_index_file
+ document_index.write_file(format: output_format)
document_group.each do |output, docs|
docs.sort_by!(&:location)
- docs.shift.write_file(true)
- docs.each(&:write_file)
+ initial = docs.shift
+ initial.header = true
+ initial.write_file(format: output_format, overwrite: true)
+ docs.each {|d| d.write_file(format: output_format) }
end
document_group.clear
end
end
@@ -66,11 +68,11 @@
description: example.full_description.dup,
location: example.location.dup,
request_method: request.env["REQUEST_METHOD"],
path_info: request.env["PATH_INFO"],
param_example: controller.params.reject {|key, val| key == "controller" || key == "action"},
- status_example: response.status.inspect,
- response_example: response.body,
+ status_code: response.status,
+ response_body: response.body,
format: GhostWriter.output_format
})
GhostWriter.document_group[output] ||= []
GhostWriter.document_group[output] << document