Sha256: 3fdab0c36638bb344c193e19a383229a6546a6ad7bb8761a42342783132e2f78
Contents?: true
Size: 614 Bytes
Versions: 2
Compression:
Stored size: 614 Bytes
Contents
# frozen_string_literal: true module CodebrekerManfly class User < ValidatableEntity attr_reader :name USERNAME_MIN_LENGTH = 3 USERNAME_MAX_LENGTH = 20 def initialize(name) super() @name = name end private def validate return add_error(:name, I18n.t(:unexpected_class_error)) unless valid_class?(String, name) add_error(:name, I18n.t(:string_min_length_error)) unless valid_string_min_length?(name, USERNAME_MIN_LENGTH) add_error(:name, I18n.t(:string_max_length_error)) unless valid_string_max_length?(name, USERNAME_MAX_LENGTH) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
codebreker_manfly-0.1.2 | lib/codebreker_manfly/entities/user.rb |
codebreker_manfly-0.1.1 | lib/codebreker_manfly/entities/user.rb |