Class: Arrolio::Font::FontManifest
- Inherits:
-
Object
- Object
- Arrolio::Font::FontManifest
- Defined in:
- lib/arrolio/font/resolver.rb
Overview
Internal lightweight view over a font_manifest: block in
layout_spec.yml. Maps family names to variant paths and exposes
the required-family list.
Instance Attribute Summary collapse
-
#fallback ⇒ Object
readonly
Returns the value of attribute fallback.
-
#families ⇒ Object
readonly
Returns the value of attribute families.
Instance Method Summary collapse
-
#initialize(families, fallback = []) ⇒ FontManifest
constructor
A new instance of FontManifest.
- #path_for(family) ⇒ Object
- #required_families ⇒ Object
Constructor Details
#initialize(families, fallback = []) ⇒ FontManifest
Returns a new instance of FontManifest.
142 143 144 145 146 |
# File 'lib/arrolio/font/resolver.rb', line 142 def initialize(families, fallback = []) @families = families.transform_keys(&:to_s) @fallback = Array(fallback) freeze end |
Instance Attribute Details
#fallback ⇒ Object (readonly)
Returns the value of attribute fallback.
140 141 142 |
# File 'lib/arrolio/font/resolver.rb', line 140 def fallback @fallback end |
#families ⇒ Object (readonly)
Returns the value of attribute families.
140 141 142 |
# File 'lib/arrolio/font/resolver.rb', line 140 def families @families end |
Instance Method Details
#path_for(family) ⇒ Object
148 149 150 151 152 153 154 |
# File 'lib/arrolio/font/resolver.rb', line 148 def path_for(family) entry = @families[family.to_s] return nil unless entry path = entry['regular'] || entry[:regular] path&.to_s end |
#required_families ⇒ Object
156 157 158 |
# File 'lib/arrolio/font/resolver.rb', line 156 def required_families @families.keys end |