Class: Fontist::GoogleImportSource
- Inherits:
-
ImportSource
- Object
- Lutaml::Model::Serializable
- ImportSource
- Fontist::GoogleImportSource
- Defined in:
- lib/fontist/google_import_source.rb
Overview
Import source for Google Fonts
Tracks the specific commit, API version, and family information for fonts imported from Google Fonts.
Note: Google Fonts filenames are NOT versioned because Google Fonts is a live service that always provides the latest version. The commit_id is tracked in import_source for metadata and update detection only.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Equality check based on commit ID.
-
#differentiation_key ⇒ nil
Returns nil - Google Fonts formulas use simple filenames.
-
#outdated?(new_source) ⇒ Boolean
Checks if this import source is older than the provided new source.
-
#to_s ⇒ String
Returns a human-readable string representation.
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Equality check based on commit ID
60 61 62 63 64 |
# File 'lib/fontist/google_import_source.rb', line 60 def ==(other) return false unless other.is_a?(GoogleImportSource) commit_id == other.commit_id end |
#differentiation_key ⇒ nil
Returns nil - Google Fonts formulas use simple filenames
Google Fonts is a live service, so formulas always point to the latest version. The commit_id is stored for metadata only.
29 30 31 |
# File 'lib/fontist/google_import_source.rb', line 29 def differentiation_key nil end |
#outdated?(new_source) ⇒ Boolean
Checks if this import source is older than the provided new source
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fontist/google_import_source.rb', line 37 def outdated?(new_source) return false unless new_source.is_a?(GoogleImportSource) return false unless commit_id && new_source.commit_id # Compare commit IDs - different commits mean potential update commit_id != new_source.commit_id rescue StandardError => e Fontist.ui.error("Error comparing Google import sources: #{e.}") false end |
#to_s ⇒ String
Returns a human-readable string representation
51 52 53 54 |
# File 'lib/fontist/google_import_source.rb', line 51 def to_s "Google Fonts (commit: #{commit_id&.slice(0, 7)}, family: #{family_id}, API: #{api_version})" end |