Class: Bookwatch::Config::Checkers::RequiredKeysChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/bookwatch/config/checkers/required_keys_checker.rb

Constant Summary collapse

MissingRequiredKeyError =
Class.new(RuntimeError)

Instance Method Summary collapse

Instance Method Details

#check(config) ⇒ Object



9
10
11
12
13
14
# File 'lib/bookwatch/config/checkers/required_keys_checker.rb', line 9

def check(config)
  missing_keys = Config::Configuration::CONFIG_REQUIRED_KEYS.reject { |key| config.has_option?(key) }
  if missing_keys.any?
    MissingRequiredKeyError.new("Your config.yml is missing required key(s). Required keys are #{missing_keys.join(", ")}.")
  end
end