Class: CC::Analyzer::Formatters::JSONFormatter
- Defined in:
- lib/cc/analyzer/formatters/json_formatter.rb
Constant Summary
Constants inherited from Formatter
Formatter::InvalidFormatterError
Instance Method Summary collapse
Methods inherited from Formatter
#finished, #initialize, #started
Constructor Details
This class inherits a constructor from CC::Analyzer::Formatters::Formatter
Instance Method Details
#engine_running(engine) ⇒ Object
6 7 8 9 10 |
# File 'lib/cc/analyzer/formatters/json_formatter.rb', line 6 def engine_running(engine) @active_engine = engine yield @active_engine = nil end |
#failed(output) ⇒ Object
20 21 22 23 24 |
# File 'lib/cc/analyzer/formatters/json_formatter.rb', line 20 def failed(output) $stderr.puts "\nAnalysis failed with the following output:" $stderr.puts output exit 1 end |
#write(data) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/cc/analyzer/formatters/json_formatter.rb', line 12 def write(data) return unless data.present? document = JSON.parse(data) document["engine_name"] = @active_engine.name puts document.to_json end |