Class: Ucode::Models::SpecialistFontManifest

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/ucode/models/specialist_font_manifest.rb

Overview

Typed view over config/specialist_fonts.yml. Carries the full list of SpecialistFont entries; provides lookup by label so the fetcher can honor --label Lentariso without scanning the array itself.

The manifest is pure data — it does not know the path it was loaded from. Persistence of computed SHA256 hashes back to disk is the responsibility of Fetch::SpecialistFontFetcher, which owns the file path and writes atomically after a run.

Instance Method Summary collapse

Instance Method Details

#find_by_label(label) ⇒ SpecialistFont?

Parameters:

  • label (String)

    exact label match

Returns:



27
28
29
# File 'lib/ucode/models/specialist_font_manifest.rb', line 27

def find_by_label(label)
  fonts.find { |font| font.label == label }
end

#labelsArray<String>

Returns labels of every entry, in declared order.

Returns:

  • (Array<String>)

    labels of every entry, in declared order



32
33
34
# File 'lib/ucode/models/specialist_font_manifest.rb', line 32

def labels
  fonts.map(&:label)
end

#only(label) ⇒ SpecialistFontManifest

Returns a new manifest containing only the matching font. Returns self unchanged if the label is unknown (the fetcher reports it as a separate failure).

Parameters:

  • label (String)

Returns:

  • (SpecialistFontManifest)

    a new manifest containing only the matching font. Returns self unchanged if the label is unknown (the fetcher reports it as a separate failure).



40
41
42
43
44
45
# File 'lib/ucode/models/specialist_font_manifest.rb', line 40

def only(label)
  match = find_by_label(label)
  return self if match.nil?

  self.class.new(fonts: [match])
end