class SpdRns::Race

Defined in:

spdrns/race.cr

Constructors

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(id : String = "<none>") #

[View source]

Instance Method Detail

def add_observer(user : User) #

[View source]
def add_participant(user : User) #

Add the given User to the Race with a certain role


[View source]
def cancel #

[View source]
def close #

[View source]
def delete(reason : String = nil) #

[View source]
def elapsed_time : Time::Span #

[View source]
def end_time : Time | Nil #

Time at which the Race timer ended (all participants finished/DOFd)


[View source]
def end_time=(end_time : Time | Nil) #

Time at which the Race timer ended (all participants finished/DOFd)


[View source]
def finish #

[View source]
def id : String #

Unique ID for the Race


[View source]
def id=(id : String) #

Unique ID for the Race


[View source]
def members : Array(Membership) #

List of members currently involved in the Race


[View source]
def members=(members : Array(Membership)) #

List of members currently involved in the Race


[View source]
def membership(user) : Membership #

Same as #member, but assumes the Member exists.


[View source]
def membership?(user) : Membership | Nil #

Return the Membership struct for the given User. Nil if the User is not a member of the Race


[View source]
def modify #

[View source]
def observers : Array(Membership) #

Return only the Memberships that are Observers of the Race


[View source]
def open #

[View source]
def participants : Array(Membership) #

Return only the Memberships that are Participants in the Race


[View source]
def pause #

[View source]
def remove_membership(user : User) #

Remove the given User's membership from the Race


[View source]
def start #

[View source]
def start_time : Time | Nil #

Time at which the Race timer starts


[View source]
def start_time=(start_time : Time | Nil) #

Time at which the Race timer starts


[View source]
def state : State #

Current state of the Race


[View source]
def state=(state : State) #

Current state of the Race


[View source]
def update_member(user, &) #

Find the Member struct for the given User, passing it to block and replacing it in the Member list with the block's return value.


[View source]
def valid_actions #

[View source]

Macro Detail

macro ensure_state(state, ret_value = false) #

[View source]