class Team
Model for a team
Overview¶ ↑
-
A team may be an opponent in a match
-
A team may be the winner of a game, a match or a set
-
A doubles team has two players
-
A singles team has one player
Singles teams are created as needed to allow a player to be an opponent in a match.
Schema Information¶ ↑
Table name: teams
id :integer not null, primary key name :string first_player_id :integer not null second_player_id :integer created_at :datetime not null updated_at :datetime not null doubles :boolean default(FALSE), not null
Public Instance Methods
include_player?(player)
click to toggle source
Indicate whether the team includes a particular player
-
Args :
-
player
-> Player
-
-
Returns : Boolean
# File app/models/team.rb, line 54 def include_player?(player) include_players?([player]) end
include_players?(players)
click to toggle source
Indicate whether the team includes all players in a list
-
Args :
-
players
-> array of players
-
-
Returns : Boolean
# File app/models/team.rb, line 46 def include_players?(players) players == [first_player, second_player] & players.compact end