Module: AlexCodebreaker::Modules::ArgumentsValidation

Includes:
Validators
Included in:
Game, Session
Defined in:
lib/alex_codebreaker/modules/arguments_validation.rb

Instance Method Summary collapse

Methods included from Validators

#argument_length_check, #argument_max_length_check, #argument_min_length_check, #digits_check

Instance Method Details

#guess_validation(guess) ⇒ Object



10
11
12
13
14
# File 'lib/alex_codebreaker/modules/arguments_validation.rb', line 10

def guess_validation(guess)
  argument_length_check(guess, AlexCodebreaker::Modules::Settings::CODE_LENGTH) &&
    digits_check(guess, AlexCodebreaker::Modules::Settings::CODE_MIN_DIGIT,
                 AlexCodebreaker::Modules::Settings::CODE_MAX_DIGIT)
end

#name_validation(name) ⇒ Object



5
6
7
8
# File 'lib/alex_codebreaker/modules/arguments_validation.rb', line 5

def name_validation(name)
  argument_min_length_check(name, AlexCodebreaker::Modules::Settings::MIN_PLAYER_NAME_LENGTH) &&
    argument_max_length_check(name, AlexCodebreaker::Modules::Settings::MAX_PLAYER_NAME_LENGTH)
end