Warn on conf when an option is not recognized
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user