class SRL::Game
Summary information about a game run on SRL
.
Attributes
This game's abbreviation, as used by RaceBot.
This game's abbreviation, as used by RaceBot.
This game's ID as per the SRL
data.
This game's leaderboard, as an array of Players.
While generally sorted by rank, this method does not guarantee the order of the players return.
If you absolutely need them sorted, use the `leaders_by_rank` method or call `sort_by(&:rank)` on this value.
The amount of ranked players on this game's leaderboard.
The amount of ranked players on this game's leaderboard.
This game's complete name.
The amount of ranked players on this game's leaderboard.
This game's ID as per the SRL
data.
This game's popularity rating, according to SRL
data.
This game's position in the popularity contest, according to SRL
data.
This game's position in the popularity contest, according to SRL
data.
This game's abbreviation, as used by RaceBot.
Statistics
about this game. Things like the number of races, number of players, total time played and raced.
- SEE
-
SRL::Statistics
Statistics
about this game. Things like the number of races, number of players, total time played and raced.
- SEE
-
SRL::Statistics
Public Instance Methods
# File lib/srl/game.rb, line 39 def leaders=(arr) @leaders = SRL::Utils.collection(arr, Runner) end
An array of players on this game's leaderboard, sorted by their rank.
# File lib/srl/game.rb, line 59 def leaders_by_rank(dir = :asc) raise ArgumentError unless %i(asc desc).include?(dir) dir == :asc ? leaders.sort_by(&:rank) : leaders.sort_by(&:rank).reverse end
# File lib/srl/game.rb, line 48 def stats=(val) @statistics = val.is_a?(Statistics) ? val : Statistics.from_hash(val) end