# frozen_string_literal: true module Codebreaker module Validator def valid? errors.empty? end private def guess_valid?(match_code) handle_errors('match code not number') unless match_code.is_a?(Numeric) input_data = match_code.to_s handle_errors('invalid_input_data') unless input_data =~ Constants::DESIRED_NUMBER valid? end def validation_name(player_name) if player_name.is_a?(String) errors << 'error min length or max length' unless Constants::LENGTH_RANGE.include?(player_name.length) else errors << 'name is not string' end end end end