Class: Achievement
- Inherits:
-
Object
- Object
- Achievement
- Defined in:
- lib/utils/game/achievements.rb
Overview
Keeps track of users achievements
Instance Method Summary collapse
- #employee_otm ⇒ Object
- #increment_chieve(chieve) ⇒ Object
-
#initialize ⇒ Achievement
constructor
A new instance of Achievement.
- #list ⇒ Object
Constructor Details
#initialize ⇒ Achievement
Returns a new instance of Achievement.
9 10 11 12 13 14 15 |
# File 'lib/utils/game/achievements.rb', line 9 def initialize @pastel = Pastel.new @store = DATA @user = @store.transaction { @store[:user] } @chieve_list = %w[employee_otm] @spinner = TTY::Spinner.new('[:spinner] :title', success_mark: @pastel.green('+')) end |
Instance Method Details
#employee_otm ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/utils/game/achievements.rb', line 26 def employee_otm if @user[/[K|k]ristian/] @spinner.auto_spin @spinner.update(title: 'Evaluating Performance') sleep 5 @spinner.update(title: 'Calculated Value Added to Company:') @spinner.success(@pastel.green("\nšØš»āš¼ Kristian has earned: Employee Of The Month\n")) increment_chieve('employee_otm') sleep 5 end end |
#increment_chieve(chieve) ⇒ Object
21 22 23 24 |
# File 'lib/utils/game/achievements.rb', line 21 def increment_chieve(chieve) puts 'š Achievement Unlocked! š' @store.transaction { @store['achievements'][chieve] += 1 } end |
#list ⇒ Object
17 18 19 |
# File 'lib/utils/game/achievements.rb', line 17 def list @chieve_list end |