class CC::Analyzer::Formatters::JSONFormatter
Public Class Methods
new(filesystem)
click to toggle source
# File lib/cc/analyzer/formatters/json_formatter.rb, line 5 def initialize(filesystem) @filesystem = filesystem @has_begun = false end
Public Instance Methods
failed(output)
click to toggle source
# File lib/cc/analyzer/formatters/json_formatter.rb, line 30 def failed(output) $stderr.puts "\nAnalysis failed with the following output:" $stderr.puts output exit 1 end
finished()
click to toggle source
# File lib/cc/analyzer/formatters/json_formatter.rb, line 14 def finished print "]\n" end
started()
click to toggle source
# File lib/cc/analyzer/formatters/json_formatter.rb, line 10 def started print "[" end
write(data)
click to toggle source
# File lib/cc/analyzer/formatters/json_formatter.rb, line 18 def write(data) document = JSON.parse(data) document["engine_name"] = current_engine.name if @has_begun print ",\n" end print document.to_json @has_begun = true end