Class: HasElo::Elo
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- HasElo::Elo
- Includes:
- Elo
- Defined in:
- lib/has_elo/elo.rb
Instance Method Summary collapse
- #loses_to(challenger) ⇒ Object
- #player ⇒ Object
- #save_stats ⇒ Object
- #ties_with(challenger) ⇒ Object
- #wins_against(challenger) ⇒ Object
Instance Method Details
#loses_to(challenger) ⇒ Object
15 16 17 18 |
# File 'lib/has_elo/elo.rb', line 15 def loses_to(challenger) player.loses_from(challenger) save_stats end |
#player ⇒ Object
6 7 8 |
# File 'lib/has_elo/elo.rb', line 6 def player @player |= Elo::Player.new(:games_played => games_played, :rating => , :pro => pro) end |
#save_stats ⇒ Object
25 26 27 28 29 30 |
# File 'lib/has_elo/elo.rb', line 25 def save_stats self. = player. self.games_played = player.games_played self.pro = player.pro save end |
#ties_with(challenger) ⇒ Object
20 21 22 23 |
# File 'lib/has_elo/elo.rb', line 20 def ties_with(challenger) player.plays_draw(challenger) save_stats end |
#wins_against(challenger) ⇒ Object
10 11 12 13 |
# File 'lib/has_elo/elo.rb', line 10 def wins_against(challenger) player.wins_from(challenger) save_stats end |