Module: EloRankable::HasEloRanking::InstanceMethods
- Defined in:
- lib/elo_rankable/has_elo_ranking.rb
Instance Method Summary collapse
-
#beat!(other_player) ⇒ Object
(also: #elo_beat!)
Domain-style DSL methods.
- #draw_with!(other_player) ⇒ Object (also: #elo_draw_with!)
- #elo_ranking ⇒ Object
- #elo_rating ⇒ Object
- #games_played ⇒ Object
- #lost_to!(other_player) ⇒ Object (also: #elo_lost_to!)
Instance Method Details
#beat!(other_player) ⇒ Object Also known as: elo_beat!
Domain-style DSL methods
34 35 36 37 |
# File 'lib/elo_rankable/has_elo_ranking.rb', line 34 def beat!(other_player) validate_opponent!(other_player) EloRankable::Calculator.(self, other_player) end |
#draw_with!(other_player) ⇒ Object Also known as: elo_draw_with!
44 45 46 47 |
# File 'lib/elo_rankable/has_elo_ranking.rb', line 44 def draw_with!(other_player) validate_opponent!(other_player) EloRankable::Calculator.(self, other_player) end |
#elo_ranking ⇒ Object
18 19 20 21 22 23 |
# File 'lib/elo_rankable/has_elo_ranking.rb', line 18 def elo_ranking super || create_elo_ranking!( rating: EloRankable.config., games_played: 0 ) end |
#elo_rating ⇒ Object
25 26 27 |
# File 'lib/elo_rankable/has_elo_ranking.rb', line 25 def elo_ranking. end |
#games_played ⇒ Object
29 30 31 |
# File 'lib/elo_rankable/has_elo_ranking.rb', line 29 def games_played elo_ranking.games_played end |
#lost_to!(other_player) ⇒ Object Also known as: elo_lost_to!
39 40 41 42 |
# File 'lib/elo_rankable/has_elo_ranking.rb', line 39 def lost_to!(other_player) validate_opponent!(other_player) EloRankable::Calculator.(other_player, self) end |