Class: SRL::Game
Defined Under Namespace
Classes: Runner
Instance Attribute Summary collapse
-
#abbrev ⇒ Object
(also: #abbreviation, #short_name)
readonly
This game’s abbreviation, as used by RaceBot.
-
#leaders ⇒ Object
This game’s leaderboard, as an array of Players.
-
#leadersCount ⇒ Object
(also: #leaders_count, #num_leaders)
readonly
The amount of ranked players on this game’s leaderboard.
-
#name ⇒ Object
readonly
This game’s complete name.
-
#oid ⇒ Object
(also: #game_id)
readonly
This game’s ID as per the SRL data.
-
#popularity ⇒ Object
readonly
This game’s popularity rating, according to SRL data.
-
#popularityrank ⇒ Object
(also: #popularity_rank)
readonly
This game’s position in the popularity contest, according to SRL data.
-
#stats ⇒ Object
(also: #statistics)
Statistics about this game.
Instance Method Summary collapse
-
#leaders_by_rank(dir = :asc) ⇒ Object
An array of players on this game’s leaderboard, sorted by their rank.
Methods included from Unmarshalable
Instance Attribute Details
#abbrev ⇒ Object (readonly) Also known as: abbreviation, short_name
This game’s abbreviation, as used by RaceBot.
17 18 19 |
# File 'lib/srl/typedefs.rb', line 17 def abbrev @abbrev end |
#leaders ⇒ Object
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.
41 42 43 |
# File 'lib/srl/typedefs.rb', line 41 def leaders @leaders end |
#leadersCount ⇒ Object (readonly) Also known as: leaders_count, num_leaders
The amount of ranked players on this game’s leaderboard.
30 31 32 |
# File 'lib/srl/typedefs.rb', line 30 def leadersCount @leadersCount end |
#name ⇒ Object (readonly)
This game’s complete name.
14 15 16 |
# File 'lib/srl/typedefs.rb', line 14 def name @name end |
#oid ⇒ Object (readonly) Also known as: game_id
This game’s ID as per the SRL data.
10 11 12 |
# File 'lib/srl/typedefs.rb', line 10 def oid @oid end |
#popularity ⇒ Object (readonly)
This game’s popularity rating, according to SRL data.
22 23 24 |
# File 'lib/srl/typedefs.rb', line 22 def popularity @popularity end |
#popularityrank ⇒ Object (readonly) Also known as: popularity_rank
This game’s position in the popularity contest, according to SRL data.
26 27 28 |
# File 'lib/srl/typedefs.rb', line 26 def popularityrank @popularityrank end |
#stats ⇒ Object Also known as: statistics
Statistics about this game. Things like the number of races, number of players, total time played and raced.
- SEE
-
SRL::Statistics
50 51 52 |
# File 'lib/srl/typedefs.rb', line 50 def stats @stats end |
Instance Method Details
#leaders_by_rank(dir = :asc) ⇒ Object
An array of players on this game’s leaderboard, sorted by their rank.
62 63 64 65 66 67 |
# File 'lib/srl/typedefs.rb', line 62 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 |