Class: NewSuperCodebreaker2021::User
- Inherits:
-
Object
- Object
- NewSuperCodebreaker2021::User
- 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
-
#attempts_total ⇒ Object
readonly
Returns the value of attribute attempts_total.
-
#attempts_used ⇒ Object
Returns the value of attribute attempts_used.
-
#difficulty ⇒ Object
readonly
Returns the value of attribute difficulty.
-
#hints_total ⇒ Object
readonly
Returns the value of attribute hints_total.
-
#hints_used ⇒ Object
Returns the value of attribute hints_used.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, difficulty) ⇒ User
constructor
A new instance of User.
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_total ⇒ Object (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_used ⇒ Object
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 |
#difficulty ⇒ Object (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_total ⇒ Object (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_used ⇒ Object
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 |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/new_super_codebreaker_2021/user.rb', line 3 def name @name end |