Class: Judges::Categories
Overview
Categories of tests.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024-2025 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
-
#initialize(enable, disable) ⇒ Categories
constructor
Ctor.
-
#ok?(cats) ⇒ Boolean
This test is good to go, with this list of categories?.
Constructor Details
#initialize(enable, disable) ⇒ Categories
Ctor.
16 17 18 19 |
# File 'lib/judges/categories.rb', line 16 def initialize(enable, disable) @enable = enable.is_a?(Array) ? enable : [] @disable = disable.is_a?(Array) ? disable : [] end |
Instance Method Details
#ok?(cats) ⇒ Boolean
This test is good to go, with this list of categories?
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/judges/categories.rb', line 24 def ok?(cats) cats = [] if cats.nil? cats = [cats] unless cats.is_a?(Array) cats.each do |c| return false if @disable.any?(c) return true if @enable.any?(c) end return true if @enable.empty? false end |