Class: StableMatching::Roommate::Validator

Inherits:
Validator
  • Object
show all
Defined in:
lib/stable-matching/roommate/validator.rb

Instance Method Summary collapse

Methods inherited from Validator

#initialize, validate!

Constructor Details

This class inherits a constructor from StableMatching::Validator

Instance Method Details

#validate!Object

rubocop:disable Metrics/CyclomaticComplexity



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/stable-matching/roommate/validator.rb', line 12

def validate!
  case
  when !hash_of_arrays?         then handle_not_hash_of_arrays
  when empty?                   then handle_empty
  when !strings_or_integers?    then handle_not_strings_or_integers
  when !even_sized?             then handle_not_even_sized
  when !symmetrical?            then handle_not_symmetrical
  end

  raise ::StableMatching::InvalidPreferences, @error if @error
end