Sha256: 02da301819551b85bb7a309f0a65e39475af035958d994f9bec2be1bab85481c
Contents?: true
Size: 1.25 KB
Versions: 67
Compression:
Stored size: 1.25 KB
Contents
require 'pact_broker/configuration' require 'pact_broker/logging' require 'pact_broker/config/setting' require 'pact_broker/config/repository' module PactBroker module Config class Save include PactBroker::Logging def self.call configuration, setting_names new(configuration, setting_names).call end def initialize configuration, setting_names @configuration = configuration @setting_names = setting_names @repository = Config::Repository.new end def call setting_names.each do | setting_name | setting_value = get_value(setting_name) if repository.class_supported?(setting_value) create_or_update_setting(setting_name, setting_value) else logger.warn "Could not save configuration setting \"#{setting_name}\" to database as the class #{setting_value.class} is not supported." end end end private attr_reader :configuration, :setting_names, :repository def create_or_update_setting setting_name, setting_value repository.create_or_update_setting(setting_name, setting_value) end def get_value setting_name configuration.send(setting_name) end end end end
Version data entries
67 entries across 67 versions & 1 rubygems