Class: Licensed::Reporters::JsonReporter
- Defined in:
- lib/licensed/reporters/json_reporter.rb
Instance Method Summary collapse
-
#end_report_app(app, report) ⇒ Object
Add source report information to the app report hash.
-
#end_report_command(command, report) ⇒ Object
Report all information from the command run to the shell as a JSON object.
-
#end_report_source(source, report) ⇒ Object
Add dependency report information to the source report hash.
Methods inherited from Reporter
#begin_report_app, #begin_report_command, #begin_report_dependency, #begin_report_source, #end_report_dependency, #initialize
Constructor Details
This class inherits a constructor from Licensed::Reporters::Reporter
Instance Method Details
#end_report_app(app, report) ⇒ Object
Add source report information to the app report hash
app - An application configuration report - A report object containing information about the app evaluation
20 21 22 |
# File 'lib/licensed/reporters/json_reporter.rb', line 20 def end_report_app(app, report) report["sources"] = report.reports.map(&:to_h) if report.reports.any? end |
#end_report_command(command, report) ⇒ Object
Report all information from the command run to the shell as a JSON object
command - The command being run report - A report object containing information about the command run
11 12 13 14 |
# File 'lib/licensed/reporters/json_reporter.rb', line 11 def end_report_command(command, report) report["apps"] = report.reports.map(&:to_h) if report.reports.any? shell.info JSON.pretty_generate(report.to_h) end |
#end_report_source(source, report) ⇒ Object
Add dependency report information to the source report hash
source - A dependency source enumerator report - A report object containing information about the source evaluation
28 29 30 |
# File 'lib/licensed/reporters/json_reporter.rb', line 28 def end_report_source(source, report) report["dependencies"] = report.reports.map(&:to_h) if report.reports.any? end |