lib/codebreaker_kirill/validations.rb in codebreaker_kirill-1.2.1 vs lib/codebreaker_kirill/validations.rb in codebreaker_kirill-1.2.3
- old
+ new
@@ -1,9 +1,11 @@
# frozen_string_literal: true
require_relative 'autoload'
class Validations
+ include Settings
+
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 < Settings::NAME_MIN_LENGTH
raise "Name shouldn't be more than 20 characters long" if name.length > Settings::NAME_MAX_LENGTH