Class: Fontist::Manifest::Locations
- Inherits:
-
Object
- Object
- Fontist::Manifest::Locations
- Defined in:
- lib/fontist/manifest/locations.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(manifest) ⇒ Locations
constructor
A new instance of Locations.
Constructor Details
Class Method Details
.from_file(file, **keywords) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/fontist/manifest/locations.rb', line 10 def self.from_file(file, **keywords) raise Fontist::Errors::ManifestCouldNotBeFoundError unless File.exist?(file) manifest = YAML.load_file(file) raise Fontist::Errors::ManifestCouldNotBeReadError unless manifest.is_a?(Hash) from_hash(manifest, **keywords) end |
.from_hash(manifest, **keywords) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/fontist/manifest/locations.rb', line 19 def self.from_hash(manifest, **keywords) if keywords.empty? new(manifest).call else new(manifest, **keywords).call end end |
Instance Method Details
#call ⇒ Object
27 28 29 |
# File 'lib/fontist/manifest/locations.rb', line 27 def call font_names.zip(font_paths).to_h end |