Class: ProconBypassMan::ButtonsSettingConfiguration::Validator
- Inherits:
-
Object
- Object
- ProconBypassMan::ButtonsSettingConfiguration::Validator
- Defined in:
- lib/procon_bypass_man/buttons_setting_configuration/validator.rb
Instance Method Summary collapse
- #errors ⇒ Hash
- #errors_to_s ⇒ Array<String>
-
#initialize(config) ⇒ Validator
constructor
A new instance of Validator.
- #invalid? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(config) ⇒ Validator
Returns a new instance of Validator.
4 5 6 7 8 9 |
# File 'lib/procon_bypass_man/buttons_setting_configuration/validator.rb', line 4 def initialize(config) @macro_plugins = config.macro_registry.plugins @mode_plugins = config.mode_registry.plugins @layers = config.layers @prefix_keys = config.prefix_keys end |
Instance Method Details
#errors ⇒ Hash
31 32 33 |
# File 'lib/procon_bypass_man/buttons_setting_configuration/validator.rb', line 31 def errors @errors ||= Hash.new {|h,k| h[k] = [] } end |
#errors_to_s ⇒ Array<String>
36 37 38 39 40 41 42 43 |
# File 'lib/procon_bypass_man/buttons_setting_configuration/validator.rb', line 36 def errors_to_s errors.map { |_x, | value = <<~EOH #{.map { |m| "layer #{m}" }.join("\n")} EOH value.chomp }.join("\n") end |
#invalid? ⇒ Boolean
26 27 28 |
# File 'lib/procon_bypass_man/buttons_setting_configuration/validator.rb', line 26 def invalid? !valid? end |
#valid? ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/procon_bypass_man/buttons_setting_configuration/validator.rb', line 12 def valid? @errors = Hash.new {|h,k| h[k] = [] } warn_blank_prefix_keys validate_flip_and_remap_are_hate_each_other validate_verify_mode_plugins validate_verify_macro_plugins @errors.empty? end |