Class: Codebreaker::Verifier
- Inherits:
-
Object
- Object
- Codebreaker::Verifier
- Defined in:
- lib/codebreaker/utils/verifier.rb
Constant Summary collapse
- COMMANDS =
{ easy: 'easy', medium: 'medium', hell: 'hell' }.freeze
Class Method Summary collapse
- .verify_valid_code(code) ⇒ Object
- .verify_valid_difficult(difficult) ⇒ Object
- .verify_valid_name(name) ⇒ Object
Class Method Details
.verify_valid_code(code) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/codebreaker/utils/verifier.rb', line 20 def verify_valid_code(code) return false unless code.is_a?(String) return false unless verify_size?(code, min_size: Game::LENGTH_CODE, max_size: Game::LENGTH_CODE) verify_include?(code) end |
.verify_valid_difficult(difficult) ⇒ Object
16 17 18 |
# File 'lib/codebreaker/utils/verifier.rb', line 16 def verify_valid_difficult(difficult) COMMANDS.values.include?(difficult) end |
.verify_valid_name(name) ⇒ Object
12 13 14 |
# File 'lib/codebreaker/utils/verifier.rb', line 12 def verify_valid_name(name) name.is_a?(String) && verify_size?(name, min_size: Player::MIN_LENGTH_NAME, max_size: Player::MAX_LENGTH_NAME) end |