class Fontist::Manifest::Locations

Public Class Methods

from_file(file, **keywords) click to toggle source
# 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) click to toggle source
# 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
new(manifest) click to toggle source
# File lib/fontist/manifest/locations.rb, line 4
def initialize(manifest)
  Fontist.ui.debug("Manifest: #{manifest}")

  @manifest = manifest
end

Public Instance Methods

call() click to toggle source
# File lib/fontist/manifest/locations.rb, line 27
def call
  font_names.zip(font_paths).to_h
end