Module: Codebreaker::Validation

Included in:
Game, Player
Defined in:
lib/modules/validation.rb

Instance Method Summary collapse

Instance Method Details

#guess_valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/modules/validation.rb', line 9

def guess_valid?(value)
  /^[1-6]{4}$/.match?(value)
end

#size_correct?(value) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/modules/validation.rb', line 5

def size_correct?(value)
  value.length.between?(3, 20)
end