Class: SportsManager::Tournament::Setting
- Defined in:
- lib/sports_manager/tournament/setting.rb
Overview
Public: The tournament’s configurations
Instance Attribute Summary collapse
-
#break_time ⇒ Object
readonly
Returns the value of attribute break_time.
-
#courts ⇒ Object
readonly
Returns the value of attribute courts.
-
#match_time ⇒ Object
readonly
Returns the value of attribute match_time.
-
#single_day_matches ⇒ Object
readonly
Returns the value of attribute single_day_matches.
-
#tournament_days ⇒ Object
readonly
Returns the value of attribute tournament_days.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #court_list ⇒ Object
-
#initialize(match_time:, break_time:, courts:, tournament_days:, single_day_matches:) ⇒ Setting
constructor
A new instance of Setting.
- #timeslots ⇒ Object
Constructor Details
#initialize(match_time:, break_time:, courts:, tournament_days:, single_day_matches:) ⇒ Setting
Returns a new instance of Setting.
9 10 11 12 13 14 15 |
# File 'lib/sports_manager/tournament/setting.rb', line 9 def initialize(match_time:, break_time:, courts:, tournament_days:, single_day_matches:) @match_time = match_time @break_time = break_time @courts = courts @tournament_days = tournament_days @single_day_matches = single_day_matches end |
Instance Attribute Details
#break_time ⇒ Object (readonly)
Returns the value of attribute break_time.
7 8 9 |
# File 'lib/sports_manager/tournament/setting.rb', line 7 def break_time @break_time end |
#courts ⇒ Object (readonly)
Returns the value of attribute courts.
7 8 9 |
# File 'lib/sports_manager/tournament/setting.rb', line 7 def courts @courts end |
#match_time ⇒ Object (readonly)
Returns the value of attribute match_time.
7 8 9 |
# File 'lib/sports_manager/tournament/setting.rb', line 7 def match_time @match_time end |
#single_day_matches ⇒ Object (readonly)
Returns the value of attribute single_day_matches.
7 8 9 |
# File 'lib/sports_manager/tournament/setting.rb', line 7 def single_day_matches @single_day_matches end |
#tournament_days ⇒ Object (readonly)
Returns the value of attribute tournament_days.
7 8 9 |
# File 'lib/sports_manager/tournament/setting.rb', line 7 def tournament_days @tournament_days end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/sports_manager/tournament/setting.rb', line 17 def ==(other) return false unless instance_of?(other.class) match_time == other.match_time && break_time == other.break_time && courts == other.courts && tournament_days == other.tournament_days && single_day_matches == other.single_day_matches end |
#court_list ⇒ Object
31 32 33 |
# File 'lib/sports_manager/tournament/setting.rb', line 31 def court_list @court_list ||= courts.times.to_a end |
#timeslots ⇒ Object
27 28 29 |
# File 'lib/sports_manager/tournament/setting.rb', line 27 def timeslots @timeslots ||= tournament_days.flat_map(&method(:build_day_slots)) end |