Class: SkillBench::Config::Applier

Inherits:
Object
  • Object
show all
Defined in:
lib/skill_bench/config/applier.rb

Overview

Applies normalized configuration hashes to a mutable store.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store:, data:) ⇒ Applier

Initializes the applier.

Parameters:

  • store (Store)

    mutable configuration store

  • data (Hash)

    normalized configuration values



21
22
23
24
# File 'lib/skill_bench/config/applier.rb', line 21

def initialize(store:, data:)
  @store = store
  @data = data
end

Class Method Details

.call(store:, data:) ⇒ Hash

Applies configuration values to a store.

Parameters:

  • store (Store)

    mutable configuration store

  • data (Hash)

    normalized configuration values

Returns:

  • (Hash)

    result envelope with applied status



12
13
14
# File 'lib/skill_bench/config/applier.rb', line 12

def self.call(store:, data:)
  new(store:, data:).call
end

Instance Method Details

#callHash

Applies configuration values to the configured store.

Returns:

  • (Hash)

    result envelope with applied status



29
30
31
32
33
34
35
36
# File 'lib/skill_bench/config/applier.rb', line 29

def call
  apply_scalar_values
  apply_provider_values
  { success: true, response: { applied: true } }
rescue StandardError => e
  SkillBench::ErrorLogger.log_error(e, 'Applier Error')
  { success: false, response: { error: { message: e.message } } }
end