Class: Licensure::Formatters::Markdown
- Defined in:
- lib/licensure/formatters/markdown.rb
Overview
Renders Markdown tables for list/check results.
Constant Summary collapse
- LIST_HEADERS =
["Gem", "Version", "License", "Source", "Homepage"].freeze
- CHECK_HEADERS =
["Gem", "Version", "License", "Source", "Reason"].freeze
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
12 13 14 15 |
# File 'lib/licensure/formatters/markdown.rb', line 12 def render(gem_license_infos) rows = gem_license_infos.map { |info| gem_row(info) } write_output(markdown_table(LIST_HEADERS, rows)) end |
#render_check_result(check_result) ⇒ String
19 20 21 22 23 24 25 26 27 |
# File 'lib/licensure/formatters/markdown.rb', line 19 def render_check_result(check_result) sections = [ markdown_section("PASSED", LIST_HEADERS, check_result.passed.map { |info| gem_row(info) }), markdown_section("VIOLATIONS", CHECK_HEADERS, check_result.violations.map { |item| violation_row(item) }), markdown_section("WARNINGS", CHECK_HEADERS, check_result.warnings.map { |item| violation_row(item) }) ] write_output(sections.join("\n\n")) end |