class SRL::Game

Summary information about a game run on SRL.

Attributes

abbrev[R]

This game's abbreviation, as used by RaceBot.

abbreviation[R]

This game's abbreviation, as used by RaceBot.

game_id[R]

This game's ID as per the SRL data.

leaders[R]

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.

leadersCount[R]

The amount of ranked players on this game's leaderboard.

leaders_count[R]

The amount of ranked players on this game's leaderboard.

name[R]

This game's complete name.

num_leaders[R]

The amount of ranked players on this game's leaderboard.

oid[R]

This game's ID as per the SRL data.

popularity[R]

This game's popularity rating, according to SRL data.

popularity_rank[R]

This game's position in the popularity contest, according to SRL data.

popularityrank[R]

This game's position in the popularity contest, according to SRL data.

short_name[R]

This game's abbreviation, as used by RaceBot.

statistics[RW]

Statistics about this game. Things like the number of races, number of players, total time played and raced.

SEE

SRL::Statistics

stats[RW]

Statistics about this game. Things like the number of races, number of players, total time played and raced.

SEE

SRL::Statistics

Public Instance Methods

leaders=(arr) click to toggle source
# File lib/srl/game.rb, line 39
def leaders=(arr)
  @leaders = SRL::Utils.collection(arr, Runner)
end
leaders_by_rank(dir = :asc) click to toggle source

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
stats=(val) click to toggle source
# File lib/srl/game.rb, line 48
def stats=(val)
  @statistics =
    val.is_a?(Statistics) ? val
                          : Statistics.from_hash(val)
end