Class: Licensure::Formatters::Csv
- Defined in:
- lib/licensure/formatters/csv.rb
Overview
Renders CSV output for list/check results.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Licensure::Formatters::Base
Instance Method Details
#render(gem_license_infos) ⇒ String
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/licensure/formatters/csv.rb', line 11 def render(gem_license_infos) content = ::CSV.generate do |csv| csv << %w[Gem Version License Source Homepage] gem_license_infos.each do |info| csv << gem_row(info) end end write_output(content) end |
#render_check_result(check_result) ⇒ String
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/licensure/formatters/csv.rb', line 24 def render_check_result(check_result) content = ::CSV.generate do |csv| csv << %w[Gem Version License Source Status Reason] check_result.passed.each do |info| csv << gem_row(info).take(4) + ["PASSED", ""] end check_result.violations.each do |violation| csv << violation_row(violation).take(4) + ["VIOLATION", violation.reason] end check_result.warnings.each do |warning| csv << violation_row(warning).take(4) + ["WARNING", warning.reason] end end write_output(content) end |