Class: AndriiCodebreaker::User

Inherits:
Object
  • Object
show all
Includes:
Constant
Defined in:
lib/andrii_codebreaker/user.rb

Constant Summary

Constants included from Constant

Constant::CODE_LENGTH, Constant::CODE_LENGTH_COUNT, Constant::CODE_START_LENGTH, Constant::DIFFICULTY, Constant::DIFFICULTY_SORT, Constant::LALA, Constant::MINUS, Constant::NAME_MAX_LENGTH, Constant::NAME_MIN_LENGTH, Constant::PLUS, Constant::RANGE_SECRET_CODE, Constant::WIN

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ User

Returns a new instance of User.



9
10
11
# File 'lib/andrii_codebreaker/user.rb', line 9

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.validate_name(name) ⇒ Object



13
14
15
# File 'lib/andrii_codebreaker/user.rb', line 13

def self.validate_name(name)
  name if name.length >= NAME_MIN_LENGTH && name.length <= NAME_MAX_LENGTH
end