Class: Ucode::Commands::Audit::CompareCommand
- Inherits:
-
Object
- Object
- Ucode::Commands::Audit::CompareCommand
- Defined in:
- lib/ucode/commands/audit/compare_command.rb
Overview
ucode audit compare LEFT RIGHT — diff two audits.
Each of LEFT and RIGHT can be:
- A path to a font file (audited on-the-fly with
{Audit::FaceAuditor}).
- A path to a face audit directory — its `index.json` is
read for the precomputed report shape.
- A path to a saved `index.json` file directly.
Note: reading from disk only recovers the derived overview shape from Emitter::IndexEmitter, not a full AuditReport. The compare therefore uses the field subset that the overview shape preserves (identity + coverage totals). For a full-feature diff, audit both inputs fresh from their font paths.
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
Instance Method Details
#call(left, right, unicode_version: nil, output_file: nil) ⇒ Result
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ucode/commands/audit/compare_command.rb', line 40 def call(left, right, unicode_version: nil, output_file: nil) left_report = load_or_audit(left, unicode_version: unicode_version) right_report = load_or_audit(right, unicode_version: unicode_version) diff = Ucode::Audit::Differ.new(left_report, right_report).diff text = Ucode::Audit::Formatters::AuditDiffText.new(diff).render write_output(text, output_file) if output_file Result.new(left_source: left, right_source: right, diff: diff, text: text) rescue StandardError => e Result.new(left_source: left, right_source: right, error: "#{e.class}: #{e.}") end |