Sha256: db1e38fa62a3a6388d56d688f75cc17b00cb5023d639c26186b029785aad63bf
Contents?: true
Size: 847 Bytes
Versions: 2
Compression:
Stored size: 847 Bytes
Contents
# frozen_string_literal: true class Validations def self.validate_name(name) raise "Name shouldn't be empty" if name.empty? raise 'Name should be string' if name.class != String raise 'Name should be at least 3 characters long' if name.length < 3 raise "Name shouldn't be more than 20 characters long" if name.length > 20 end def self.validate_guess(guess) raise "Guess shouldn't be empty" if guess.empty? raise 'Guess should be at least 3 characters long' if guess.length < 4 raise 'Guess shouldn\'t be more than 4 characters long' if guess.length > 4 end def self.validate_difficulty(difficulty) raise "Input shouldn't be empty" if difficulty.empty? return if Settings::DIFFICULTY.keys.include?(difficulty) raise 'You should enter one of the following options: easy, medium, hell' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
codebreaker_kirill-1.1.1 | lib/codebreaker_kirill/validations.rb |
codebreaker_kirill-1.1.0 | lib/codebreaker_kirill/validations.rb |