Class: Ucode::Models::SpecialistFontManifest
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Ucode::Models::SpecialistFontManifest
- 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
- #find_by_label(label) ⇒ SpecialistFont?
-
#labels ⇒ Array<String>
Labels of every entry, in declared order.
-
#only(label) ⇒ SpecialistFontManifest
A new manifest containing only the matching font.
Instance Method Details
#find_by_label(label) ⇒ SpecialistFont?
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 |
#labels ⇒ Array<String>
Returns 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).
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 |