class CC::Config::ChecksAdapter

Attributes

config[R]

Public Class Methods

new(data = {}) click to toggle source
# File lib/cc/config/checks_adapter.rb, line 6
def initialize(data = {})
  @config = data

  return unless checks.present?
  copy_qm_checks_config
end

Private Instance Methods

checks() click to toggle source
# File lib/cc/config/checks_adapter.rb, line 35
def checks
  config["checks"]
end
copy_checks(engine_name) click to toggle source
# File lib/cc/config/checks_adapter.rb, line 21
def copy_checks(engine_name)
  engine = config.fetch("plugins", {}).fetch(engine_name, {})
  engine["config"] ||= {}

  if engine["config"].is_a?(String)
    engine["config"] = {
      "file" => engine["config"],
      "checks" => checks,
    }
  elsif engine["config"].is_a?(Hash)
    engine["config"]["checks"] = checks
  end
end
copy_qm_checks_config() click to toggle source
# File lib/cc/config/checks_adapter.rb, line 15
def copy_qm_checks_config
  DefaultAdapter::ENGINES.keys.each do |name|
    copy_checks(name)
  end
end