Class: NewSuperCodebreaker2021::User

Inherits:
Object
  • Object
show all
Defined in:
lib/new_super_codebreaker_2021/user.rb

Constant Summary collapse

DIFFICULTY =
{
  easy: { attempts: 15, hints: 2 },
  medium: { attempts: 10, hints: 1 },
  hell: { attempts: 5, hints: 1 }
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, difficulty) ⇒ User

Returns a new instance of User.



12
13
14
15
16
17
18
# File 'lib/new_super_codebreaker_2021/user.rb', line 12

def initialize(name, difficulty)
  @name = name
  @difficulty = difficulty
  @hints_used = 0
  @attempts_used = 0
  set_total_fields
end

Instance Attribute Details

#attempts_totalObject (readonly)

Returns the value of attribute attempts_total.



3
4
5
# File 'lib/new_super_codebreaker_2021/user.rb', line 3

def attempts_total
  @attempts_total
end

#attempts_usedObject

Returns the value of attribute attempts_used.



4
5
6
# File 'lib/new_super_codebreaker_2021/user.rb', line 4

def attempts_used
  @attempts_used
end

#difficultyObject (readonly)

Returns the value of attribute difficulty.



3
4
5
# File 'lib/new_super_codebreaker_2021/user.rb', line 3

def difficulty
  @difficulty
end

#hints_totalObject (readonly)

Returns the value of attribute hints_total.



3
4
5
# File 'lib/new_super_codebreaker_2021/user.rb', line 3

def hints_total
  @hints_total
end

#hints_usedObject

Returns the value of attribute hints_used.



4
5
6
# File 'lib/new_super_codebreaker_2021/user.rb', line 4

def hints_used
  @hints_used
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/new_super_codebreaker_2021/user.rb', line 3

def name
  @name
end