Class: SportsManager::GroupBuilder
- Defined in:
- lib/sports_manager/group_builder.rb
Overview
Public: Builds a group with matches, teams, and participants from a payload
category - The matches’ category. subscriptions - The players subscribed. Doubles are represented as a nested list. matches - A list of matches. Each match is represented by a list of
players that will be participaing in it.
Example 1: A Team of one player Mixed single category with subscribed players: João, Marcelo, Bruno, and Fábio. The initial matches will be:
* Jo
Example 2: A team of two players Women’s double category with subscribed players: Laura, Karina, Camila, Bruna, Carolina, Patricia, Jéssica, and Daniela.
The initial matches will be:
* Laura and Karina vs J
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#matches ⇒ Object
readonly
Returns the value of attribute matches.
-
#subscriptions ⇒ Object
readonly
Returns the value of attribute subscriptions.
-
#tournament_type ⇒ Object
readonly
Returns the value of attribute tournament_type.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(category:, subscriptions:, matches:, tournament_type:) ⇒ GroupBuilder
constructor
A new instance of GroupBuilder.
Constructor Details
#initialize(category:, subscriptions:, matches:, tournament_type:) ⇒ GroupBuilder
Returns a new instance of GroupBuilder.
51 52 53 54 55 56 |
# File 'lib/sports_manager/group_builder.rb', line 51 def initialize(category:, subscriptions:, matches:, tournament_type:) @category = category @subscriptions = subscriptions @matches = matches @tournament_type = tournament_type end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
49 50 51 |
# File 'lib/sports_manager/group_builder.rb', line 49 def category @category end |
#matches ⇒ Object (readonly)
Returns the value of attribute matches.
49 50 51 |
# File 'lib/sports_manager/group_builder.rb', line 49 def matches @matches end |
#subscriptions ⇒ Object (readonly)
Returns the value of attribute subscriptions.
49 50 51 |
# File 'lib/sports_manager/group_builder.rb', line 49 def subscriptions @subscriptions end |
#tournament_type ⇒ Object (readonly)
Returns the value of attribute tournament_type.
49 50 51 |
# File 'lib/sports_manager/group_builder.rb', line 49 def tournament_type @tournament_type end |
Instance Method Details
#build ⇒ Object
58 59 60 |
# File 'lib/sports_manager/group_builder.rb', line 58 def build Group.new(category: category, matches: builded_matches, teams: teams) end |