Class: Bookbinder::Config::Checkers::RequiredKeysChecker
- Inherits:
-
Object
- Object
- Bookbinder::Config::Checkers::RequiredKeysChecker
- Defined in:
- lib/bookbinder/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 15 16 17 18 19 20 21 22 23 |
# File 'lib/bookbinder/config/checkers/required_keys_checker.rb', line 9 def check(config) missing_keys = [] Config::Configuration::CONFIG_REQUIRED_KEYS.each do |required_key| begin config.public_send(required_key) rescue KeyError missing_keys.push(required_key) end end if missing_keys.length > 0 MissingRequiredKeyError.new("Your config.yml is missing required key(s). Required keys are #{missing_keys.join(", ")}.") end end |