From 687e96e08d6f4f475e3890bd03e0cc95c8908c12 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 14 Aug 2024 03:03:38 -0700 Subject: [PATCH] Delint, cleanup code --- _plugins/config_validator.rb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/_plugins/config_validator.rb b/_plugins/config_validator.rb index 0ad2ff7..73b3723 100644 --- a/_plugins/config_validator.rb +++ b/_plugins/config_validator.rb @@ -56,9 +56,9 @@ def validate KEY_VALIDATIONS.each do |key, validator| if validator == :inclusion_validator - send(validator, key, config[key.to_s], self.class.const_get("VALID_#{key.upcase}")) - else - send(validator, config[key.to_s]) if @config.key?(key.to_s) + send(validator, key, config[key.to_s], ConfigValidator.const_get("VALID_#{key.upcase}")) + elsif @config.key?(key.to_s) + send(validator, config[key.to_s]) end end @@ -92,14 +92,6 @@ def validate_semester_format(baseurl) errors << "`baseurl` must be a valid semester (faXX, spXX, suXX or wiXX), not #{baseurl}" end - def validate_department(dept) - errors << "`course_department` must be one of #{VALID_DEPTS} (not '#{dept}')" unless VALID_DEPTS.include?(dept) - end - - def validate_color_theme(color_theme) - errors << "`course_department` must be one of #{VALID_DEPTS} (not '#{dept}')" unless VALID_DEPTS.include?(dept) - end - def inclusion_validator(key, value, allowed) errors << "`#{key}` must be one of #{allowed} (not '#{value}')" unless allowed.include?(value) end