Sha256: e507cb8b9a0ef682d8f0a0e850a4b912ccafac1a1af5adab8954827185694db1

Contents?: true

Size: 411 Bytes

Versions: 13

Compression:

Stored size: 411 Bytes

Contents

# frozen_string_literal: true

module Codebreaker
  module Entities
    class User
      include Validator
      USERNAME_CONSTRAINTS = { min: 3, max: 20 }.freeze

      attr_reader :name

      def initialize(name)
        @name = name
        validate
      end

      private

      def validate
        check_type(@name, String)
        check_length(@name, USERNAME_CONSTRAINTS)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
codebreaker_marian-0.3.6 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.3.5 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.3.4 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.3.3 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.3.2 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.3.1 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.3.0 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.2.9 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.2.8 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.2.7 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.2.6 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.2.5 lib/codebreaker_marian/entities/user.rb
codebreaker_marian-0.2.4 lib/codebreaker_marian/entities/user.rb