Class: Fontist::MacosImportSource
- Inherits:
-
ImportSource
- Object
- Lutaml::Model::Serializable
- ImportSource
- Fontist::MacosImportSource
- Defined in:
- lib/fontist/macos_import_source.rb
Overview
Import source for macOS supplementary fonts
Tracks the specific framework version, catalog posting date, and asset ID for fonts imported from Appleās macOS font catalogs.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Equality check based on differentiation key.
-
#compatible_with_macos?(macos_version) ⇒ Boolean
Checks if this import source is compatible with a specific macOS version.
-
#description ⇒ String
Gets the description for this framework.
-
#differentiation_key ⇒ String?
Returns the asset ID in lowercase for consistent differentiation.
-
#max_macos_version ⇒ String?
Gets the maximum macOS version for this framework.
-
#min_macos_version ⇒ String?
Gets the minimum macOS version for this framework.
-
#outdated?(new_source) ⇒ Boolean
Checks if this import source is older than the provided new source.
-
#parser_class ⇒ String
Gets the parser class name for this framework.
-
#to_s ⇒ String
Returns a human-readable string representation.
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Equality check based on differentiation key
87 88 89 90 91 92 |
# File 'lib/fontist/macos_import_source.rb', line 87 def ==(other) return false unless other.is_a?(MacosImportSource) framework_version == other.framework_version && asset_id&.downcase == other.asset_id&.downcase end |
#compatible_with_macos?(macos_version) ⇒ Boolean
Checks if this import source is compatible with a specific macOS version
57 58 59 60 |
# File 'lib/fontist/macos_import_source.rb', line 57 def compatible_with_macos?(macos_version) MacosFrameworkMetadata.compatible_with_macos?(framework_version, macos_version) end |
#description ⇒ String
Gets the description for this framework
79 80 81 |
# File 'lib/fontist/macos_import_source.rb', line 79 def description MacosFrameworkMetadata.description(framework_version) end |
#differentiation_key ⇒ String?
Returns the asset ID in lowercase for consistent differentiation
21 22 23 |
# File 'lib/fontist/macos_import_source.rb', line 21 def differentiation_key asset_id&.downcase end |
#max_macos_version ⇒ String?
Gets the maximum macOS version for this framework
49 50 51 |
# File 'lib/fontist/macos_import_source.rb', line 49 def max_macos_version MacosFrameworkMetadata.max_macos_version(framework_version) end |
#min_macos_version ⇒ String?
Gets the minimum macOS version for this framework
42 43 44 |
# File 'lib/fontist/macos_import_source.rb', line 42 def min_macos_version MacosFrameworkMetadata.min_macos_version(framework_version) end |
#outdated?(new_source) ⇒ Boolean
Checks if this import source is older than the provided new source
29 30 31 32 33 34 35 36 37 |
# File 'lib/fontist/macos_import_source.rb', line 29 def outdated?(new_source) return false unless new_source.is_a?(MacosImportSource) return false unless posted_date && new_source.posted_date Time.parse(posted_date) < Time.parse(new_source.posted_date) rescue StandardError => e Fontist.ui.error("Error comparing import sources: #{e.}") false end |
#parser_class ⇒ String
Gets the parser class name for this framework
72 73 74 |
# File 'lib/fontist/macos_import_source.rb', line 72 def parser_class MacosFrameworkMetadata.parser_class(framework_version) end |
#to_s ⇒ String
Returns a human-readable string representation
65 66 67 |
# File 'lib/fontist/macos_import_source.rb', line 65 def to_s "macOS Font#{framework_version} (posted: #{posted_date}, asset: #{asset_id})" end |