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
#initialize(manifest) ⇒ Locations
Returns a new instance of Locations.
4 5 6 |
# File 'lib/fontist/manifest/locations.rb', line 4 def initialize(manifest) @manifest = manifest end |
Class Method Details
.from_file(file, **keywords) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/fontist/manifest/locations.rb', line 8 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
17 18 19 20 21 22 23 |
# File 'lib/fontist/manifest/locations.rb', line 17 def self.from_hash(manifest, **keywords) if keywords.empty? new(manifest).call else new(manifest, **keywords).call end end |
Instance Method Details
#call ⇒ Object
25 26 27 |
# File 'lib/fontist/manifest/locations.rb', line 25 def call font_names.zip(font_paths).to_h end |