Sha256: 6f3e0a51843375730b3121c8d7d4768145bcc4997d71f2773e4c51caabcbeb06

Contents?: true

Size: 411 Bytes

Versions: 6

Compression:

Stored size: 411 Bytes

Contents

# frozen_string_literal: true

# Main Gem module
module CodeBrkrGameTraining
  # Class for game user
  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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
code_brkr_game_training-0.9.2 lib/code_brkr_game_training/entities/user.rb
code_brkr_game_training-0.9.1 lib/code_brkr_game_training/entities/user.rb
code_brkr_game_training-0.8.5 lib/code_brkr_game_training/entities/user.rb
code_brkr_game_training-0.8.0 lib/code_brkr_game_training/entities/user.rb
code_brkr_game_training-0.7.5 lib/code_brkr_game_training/entities/user.rb
code_brkr_game_training-0.7.2 lib/code_brkr_game_training/entities/user.rb