class SRL::Race

A race that has not yet been recorded or closed.

Constants

STATES

Attributes

channel[R]

The IRC channel suffix for this race.

entrants[R]

The players enlisted in this race as an array of Entrants.

game[R]

The game associate with this race.

goal[RW]
numentrants[RW]
oid[R]

The IRC channel suffix for this race.

state[R]

The state of this race. Entry Open / In Progress / Completed

FIXME

Switch to enum-like behaviour with symbols.

time[RW]

Public Instance Methods

entrants=(arr) click to toggle source
# File lib/srl/race.rb, line 36
def entrants=(arr)
  # Account for the api returning a hash with the entrants' name
  # as key instead of an array, despite repeating the entrants name
  # in `displayname`.
  arr = arr.is_a?(Hash) ? arr.values : arr
  @entrants = SRL::Utils.collection(arr, Entrant)
end
game=(game) click to toggle source
# File lib/srl/race.rb, line 29
def game=(game)
  @game = game.is_a?(Game) ? game
                           : Game.from_hash(game)
end
status() click to toggle source
# File lib/srl/race.rb, line 21
def status
  STATES[state - 1]
rescue
  :unknown
end