class StableMatching::Roommate::Validator

Public Instance Methods

validate!() click to toggle source

rubocop:disable Metrics/CyclomaticComplexity

# 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