Class: Codebreaker::User

Inherits:
Object
  • Object
show all
Includes:
Validation
Defined in:
lib/codebreaker/user.rb

Constant Summary collapse

NAME_LENGTH =
(3..20).freeze

Constants included from Validation

Validation::ERROR_MESSAGES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validation

#raise_error, #validate_difficulty, #validate_file_existens, #validate_guess, #validate_hints, #validate_user_name

Constructor Details

#initialize(name:) ⇒ User



11
12
13
14
# File 'lib/codebreaker/user.rb', line 11

def initialize(name:)
  validate_user_name(name, NAME_LENGTH)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/codebreaker/user.rb', line 7

def name
  @name
end