Class: Score
- Inherits:
-
Object
- Object
- Score
- Defined in:
- lib/utils/game/score.rb
Overview
Keeps track of users score
Instance Method Summary collapse
-
#initialize ⇒ Score
constructor
A new instance of Score.
-
#report_quests ⇒ Object
QUESTS ==========================.
-
#report_score ⇒ Object
jiraS ==========================.
- #reset_score ⇒ Object
- #update_and_print(number) ⇒ Object
- #update_points(number) ⇒ Object
- #update_quests(quest) ⇒ Object
- #update_quests_and_print(number) ⇒ Object
Constructor Details
Instance Method Details
#report_quests ⇒ Object
QUESTS ==========================
38 39 40 |
# File 'lib/utils/game/score.rb', line 38 def report_quests puts "You have completed #{@quests} Quests" end |
#report_score ⇒ Object
jiraS ==========================
14 15 16 |
# File 'lib/utils/game/score.rb', line 14 def report_score puts "You have #{@score} jiras" end |
#reset_score ⇒ Object
18 19 20 21 22 23 |
# File 'lib/utils/game/score.rb', line 18 def reset_score @store.transaction do store = @store store[:score] = 0 end end |
#update_and_print(number) ⇒ Object
32 33 34 35 |
# File 'lib/utils/game/score.rb', line 32 def update_and_print(number) update_points(number) report_score end |
#update_points(number) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/utils/game/score.rb', line 25 def update_points(number) @store.transaction do store = @store store[:score] += number end end |
#update_quests(quest) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/utils/game/score.rb', line 42 def update_quests(quest) @store.transaction do store = @store store['quests'][quest.to_s] = 'DONE' end end |
#update_quests_and_print(number) ⇒ Object
49 50 51 52 |
# File 'lib/utils/game/score.rb', line 49 def update_quests_and_print(number) update_quests(number) report_quests end |