Class: EloRatings::Results
- Inherits:
-
Object
- Object
- EloRatings::Results
- Defined in:
- lib/elo_ratings/results.rb
Instance Method Summary collapse
- #add_game(player_1, player_2, result) ⇒ Object
- #count_games_for(player) ⇒ Object
- #elo_for(player) ⇒ Object
-
#initialize ⇒ Results
constructor
A new instance of Results.
Constructor Details
Instance Method Details
#add_game(player_1, player_2, result) ⇒ Object
8 9 10 |
# File 'lib/elo_ratings/results.rb', line 8 def add_game player_1, player_2, result @c_bayeselo.append index_for!(player_1), index_for!(player_2), result end |
#count_games_for(player) ⇒ Object
12 13 14 15 |
# File 'lib/elo_ratings/results.rb', line 12 def count_games_for player return 0 if !exists? player @c_bayeselo.count_games index_for(player) end |
#elo_for(player) ⇒ Object
17 18 19 20 |
# File 'lib/elo_ratings/results.rb', line 17 def elo_for player return nil if !exists? player @c_bayeselo.get_elo index_for(player) end |