Class: LittleGhost::Models::Catalog::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/little_ghost/models/catalog/source.rb

Overview

Interface for catalog refresh implementations.

Constant Summary collapse

DEFAULT_ATTRIBUTE_MERGE_STRATEGIES =

:nodoc:

{}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (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_strategiesObject

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