Class: Ucode::Audit::Release::FormulaAudits

Inherits:
Struct
  • Object
show all
Defined in:
lib/ucode/audit/release/formula_audits.rb

Overview

Value object pairing a formula slug with the library-wide audit summary produced by running LibraryAuditor on that formula's font directory.

Used as the input unit to Emitter: callers pass a list of these and the emitter walks each one's summary.per_face_reports to emit the per-face audit subtrees.

The slug MUST be caller-sanitized (fontist formula slug form: lowercase, hyphen-separated, filesystem-safe). The emitter does not re-sanitize — it uses the slug verbatim as the directory name under <release_root>/audit/.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slug:, summary:) ⇒ FormulaAudits

Sanity check at construction time so a malformed slug fails fast at the call site instead of producing a broken tree.

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
# File 'lib/ucode/audit/release/formula_audits.rb', line 21

def initialize(slug:, summary:)
  raise ArgumentError, "slug must not be empty" if slug.to_s.strip.empty?
  raise ArgumentError, "slug contains path separators: #{slug.inspect}" if slug[%r{/}]
  raise ArgumentError, "summary is required" unless summary

  slug = slug.to_s
  raise ArgumentError, "slug is not filesystem-safe: #{slug.inspect}" unless safe_slug?(slug)

  super(slug: slug, summary: summary)
end

Instance Attribute Details

#slugObject

Returns the value of attribute slug

Returns:

  • (Object)

    the current value of slug



18
19
20
# File 'lib/ucode/audit/release/formula_audits.rb', line 18

def slug
  @slug
end

#summaryObject

Returns the value of attribute summary

Returns:

  • (Object)

    the current value of summary



18
19
20
# File 'lib/ucode/audit/release/formula_audits.rb', line 18

def summary
  @summary
end

Instance Method Details

#face_reportsEnumerable<Models::Audit::AuditReport>

Returns:



38
39
40
# File 'lib/ucode/audit/release/formula_audits.rb', line 38

def face_reports
  summary.per_face_reports
end

#faces_totalInteger

Returns number of face reports in the summary.

Returns:

  • (Integer)

    number of face reports in the summary



33
34
35
# File 'lib/ucode/audit/release/formula_audits.rb', line 33

def faces_total
  summary.total_faces
end