Class: Rigor::CLI::TypeScanRenderer
- Inherits:
-
Object
- Object
- Rigor::CLI::TypeScanRenderer
- Defined in:
- lib/rigor/cli/type_scan_renderer.rb
Overview
Renders a ‘TypeScanCommand::Report` as either a terminal-friendly text summary or a JSON document suitable for CI ingestion. Text and JSON branches share a single source of truth (the `Report` value object) so the two formats stay in lockstep; that pairing is why this class is a bit longer than the default class-length budget.
Instance Method Summary collapse
-
#initialize(out:) ⇒ TypeScanRenderer
constructor
rubocop:disable Metrics/ClassLength.
- #render(report, format:) ⇒ Object
Constructor Details
#initialize(out:) ⇒ TypeScanRenderer
rubocop:disable Metrics/ClassLength
14 15 16 |
# File 'lib/rigor/cli/type_scan_renderer.rb', line 14 def initialize(out:) @out = out end |
Instance Method Details
#render(report, format:) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/rigor/cli/type_scan_renderer.rb', line 18 def render(report, format:) case format when "text" then render_text(report) when "json" then render_json(report) else raise OptionParser::InvalidArgument, "unsupported format: #{format}" end end |