Class: LittleGhost::Models::Catalog::Source
- Inherits:
-
Object
- Object
- LittleGhost::Models::Catalog::Source
- Defined in:
- lib/little_ghost/models/catalog/source.rb
Overview
Interface for catalog refresh implementations.
Direct Known Subclasses
ModelsDevSource, Providers::Anthropic::CatalogSource, Providers::Bedrock::CatalogSource, Providers::Gemini::CatalogSource, Providers::OpenRouter::CatalogSource
Constant Summary collapse
- DEFAULT_ATTRIBUTE_MERGE_STRATEGIES =
:nodoc:
{}.freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Stable provenance name recorded for refreshed facts.
Instance Method Summary collapse
-
#attribute_merge_strategies ⇒ Object
Returns exceptional attribute merge strategies for records from this source.
-
#initialize(name:) ⇒ Source
constructor
Creates a source with its provenance
name. -
#refresh(target: nil) ⇒ Object
Returns normalized model records, optionally scoped to
target.
Constructor Details
#initialize(name:) ⇒ Source
Creates a source with its provenance name.
14 15 16 |
# File 'lib/little_ghost/models/catalog/source.rb', line 14 def initialize(name:) @name = name.to_s.freeze end |
Instance Attribute Details
#name ⇒ Object (readonly)
Stable provenance name recorded for refreshed facts.
11 12 13 |
# File 'lib/little_ghost/models/catalog/source.rb', line 11 def name @name end |
Instance Method Details
#attribute_merge_strategies ⇒ Object
Returns exceptional attribute merge strategies for records from this
source. Attributes replace older values unless an array is mapped to
:union.
21 |
# File 'lib/little_ghost/models/catalog/source.rb', line 21 def attribute_merge_strategies = DEFAULT_ATTRIBUTE_MERGE_STRATEGIES |
#refresh(target: nil) ⇒ Object
Returns normalized model records, optionally scoped to target.
24 25 26 |
# File 'lib/little_ghost/models/catalog/source.rb', line 24 def refresh(target: nil) raise AbstractMethodError, "#{self.class} must implement #refresh" end |