Warn on conf when an option is not recognized

This commit is contained in:
Andy Meneely
2015-10-26 16:14:13 -04:00
parent 47b5f569a4
commit 7126afbc9c
4 changed files with 22 additions and 3 deletions
+9
View File
@@ -52,6 +52,7 @@ module Squib
Squib::logger.info { " using config: #{file}" }
yaml = YAML.load_file(file) || {}
end
warn_unrecognized(yaml)
Conf.new(DEFAULTS.merge(yaml))
end
@@ -113,5 +114,13 @@ module Squib
@config_hash['antialias'] = ANTIALIAS_OPTS[@config_hash['antialias'].downcase.strip]
end
# Were there any unrecognized options in the config file?
def self.warn_unrecognized(yaml)
unrec = yaml.keys - DEFAULTS.keys
if unrec.any?
Squib::logger.warn "Unrecognized configuration option(s): #{unrec.join(',')}"
end
end
end
end