Class: Fontist::ImportSource Abstract

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/fontist/import_source.rb

Overview

This class is abstract.

Base class for import sources. Use subclasses like MacosImportSource, GoogleImportSource, or SilImportSource instead.

Base class for import source metadata

This provides a polymorphic way to track where and how fonts were imported from. Each subclass handles source-specific metadata while maintaining a consistent interface.

Instance Method Summary collapse

Instance Method Details

#differentiation_keyString

This method is abstract.

Subclasses must implement this

Returns a key that can be used to differentiate this source from others

Returns:

  • (String)

    A unique key for this import source

Raises:

  • (NotImplementedError)


25
26
27
28
# File 'lib/fontist/import_source.rb', line 25

def differentiation_key
  raise NotImplementedError,
        "#{self.class} must implement #differentiation_key"
end

#outdated?(new_source) ⇒ Boolean

This method is abstract.

Subclasses must implement this

Checks if this source is older than the provided new source

Parameters:

  • new_source (ImportSource)

    The new source to compare against

Returns:

  • (Boolean)

    true if this source is outdated

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/fontist/import_source.rb', line 34

def outdated?(new_source)
  raise NotImplementedError, "#{self.class} must implement #outdated?"
end

#to_sString

This method is abstract.

Subclasses should implement this for debugging/logging

String representation of the import source

Returns:

  • (String)

    Human-readable string representation



41
42
43
# File 'lib/fontist/import_source.rb', line 41

def to_s
  "#{self.class.name} (type: #{type})"
end