class Fontist::Import::Google::DataSources::Github
Data source for fetching font data from Google Fonts GitHub repository
This data source reads font metadata from a local clone of the Google Fonts repository, parsing METADATA.pb files and extracting information from font files using otfinfo.
Attributes
Public Class Methods
Source
# File lib/fontist/import/google/data_sources/github.rb, line 22 def initialize(source_path:) @source_path = Pathname.new(source_path) @cache = nil validate_source_path! end
Initialize a new GitHub data source
@param source_path [String] Path to Google Fonts repository
Public Instance Methods
Source
# File lib/fontist/import/google/data_sources/github.rb, line 51 def clear_cache @cache = nil end
Clear the internal cache
@return [nil]
Source
# File lib/fontist/import/google/data_sources/github.rb, line 31 def fetch return @cache if @cache @cache = parse_all_fonts end
Fetch and parse all font families from the repository
@return [Array<FontFamily>] array of parsed font family models
Source
# File lib/fontist/import/google/data_sources/github.rb, line 41 def fetch_family(name) family_path = find_family_path(name) return nil unless family_path parse_family(family_path) end
Fetch a specific font family by name
@param name [String] the font family name @return [FontFamily, nil] the font family if found