Class: Fontist::SilImportSource

Inherits:
ImportSource
  • Object
show all
Defined in:
lib/fontist/sil_import_source.rb

Overview

Import source for SIL International fonts

Tracks version and release information for fonts imported from SIL.

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Equality check based on differentiation key

Parameters:

  • other (Object)

    The object to compare

Returns:

  • (Boolean)

    true if objects are equal



47
48
49
50
51
# File 'lib/fontist/sil_import_source.rb', line 47

def ==(other)
  return false unless other.is_a?(SilImportSource)

  version == other.version
end

#differentiation_keyString?

Returns the version as the differentiation key

Returns:

  • (String, nil)

    The version or nil



17
18
19
# File 'lib/fontist/sil_import_source.rb', line 17

def differentiation_key
  version
end

#outdated?(new_source) ⇒ Boolean

Checks if this import source is older than the provided new source

Parameters:

Returns:

  • (Boolean)

    true if this source is outdated



25
26
27
28
29
30
31
32
33
34
# File 'lib/fontist/sil_import_source.rb', line 25

def outdated?(new_source)
  return false unless new_source.is_a?(SilImportSource)
  return false unless version && new_source.version

  # Compare versions lexicographically (assumes semantic versioning)
  version < new_source.version
rescue StandardError => e
  Fontist.ui.error("Error comparing SIL import sources: #{e.message}")
  false
end

#to_sString

Returns a human-readable string representation

Returns:

  • (String)

    String representation for debugging/logging



39
40
41
# File 'lib/fontist/sil_import_source.rb', line 39

def to_s
  "SIL Fonts (version: #{version}, released: #{release_date})"
end