Class: Ace::Handbook::Organisms::ProviderSyncer

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/handbook/organisms/provider_syncer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_root: Ace::Handbook.project_root, registry: nil, inventory: nil, config: nil) ⇒ ProviderSyncer

Returns a new instance of ProviderSyncer.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ace/handbook/organisms/provider_syncer.rb', line 11

def initialize(
  project_root: Ace::Handbook.project_root,
  registry: nil,
  inventory: nil,
  config: nil
)
  @project_root = project_root
  @registry = registry || Atoms::ProviderRegistry.new(project_root: project_root)
  @inventory = inventory || SkillInventory.new(project_root: project_root)
  @config = config || Ace::Handbook.config.resolve_namespace("handbook").to_h
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



9
10
11
# File 'lib/ace/handbook/organisms/provider_syncer.rb', line 9

def config
  @config
end

#inventoryObject (readonly)

Returns the value of attribute inventory.



9
10
11
# File 'lib/ace/handbook/organisms/provider_syncer.rb', line 9

def inventory
  @inventory
end

#project_rootObject (readonly)

Returns the value of attribute project_root.



9
10
11
# File 'lib/ace/handbook/organisms/provider_syncer.rb', line 9

def project_root
  @project_root
end

#registryObject (readonly)

Returns the value of attribute registry.



9
10
11
# File 'lib/ace/handbook/organisms/provider_syncer.rb', line 9

def registry
  @registry
end

Instance Method Details

#sync(provider: nil) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/ace/handbook/organisms/provider_syncer.rb', line 23

def sync(provider: nil)
  skills = inventory.all
  source_breakdown = summarize_sources(skills)
  providers_to_sync(provider).map do |provider_id|
    sync_provider(provider_id, skills: skills, source_breakdown: source_breakdown)
  end
end