class V1::SetGameSerializer

Serializes a SetGame with the following attributes:

Public Instance Methods

server() click to toggle source

Serialize the Player id of the game server.

# File app/serializers/v1/set_game_serializer.rb, line 37
def server
  object.player_server_id
end
tiebreak() click to toggle source

Indicate a tiebreak game

  • Returns : true or nil

# File app/serializers/v1/set_game_serializer.rb, line 29
def tiebreak
  object.tiebreak? ? true : nil
end
winner() click to toggle source

Serialize the Player or Team id of the game winner

# File app/serializers/v1/set_game_serializer.rb, line 13
def winner
  if object.team_winner.nil?
    nil
  else
    if object.match_set.match.doubles
      object.team_winner.id
    else
      object.team_winner.first_player.id
    end
  end
end