Class: SportsManager::TimeslotBuilder
- Extended by:
- Forwardable
- Defined in:
- lib/sports_manager/timeslot_builder.rb
Overview
NOTE: maybe change the name since we are not creating a Timeslot object here Public: Builds the possible timeslots as Time objects
Instance Attribute Summary collapse
-
#tournament_day ⇒ Object
readonly
Returns the value of attribute tournament_day.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(tournament_day:, interval:) ⇒ TimeslotBuilder
constructor
A new instance of TimeslotBuilder.
Constructor Details
#initialize(tournament_day:, interval:) ⇒ TimeslotBuilder
Returns a new instance of TimeslotBuilder.
19 20 21 22 |
# File 'lib/sports_manager/timeslot_builder.rb', line 19 def initialize(tournament_day:, interval:) @tournament_day = tournament_day @interval = interval end |
Instance Attribute Details
#tournament_day ⇒ Object (readonly)
Returns the value of attribute tournament_day.
11 12 13 |
# File 'lib/sports_manager/timeslot_builder.rb', line 11 def tournament_day @tournament_day end |
Class Method Details
.build(tournament_day:, interval:) ⇒ Object
15 16 17 |
# File 'lib/sports_manager/timeslot_builder.rb', line 15 def self.build(tournament_day:, interval:) new(tournament_day: tournament_day, interval: interval).build end |
Instance Method Details
#build ⇒ Object
24 25 26 |
# File 'lib/sports_manager/timeslot_builder.rb', line 24 def build time_range.step(interval).map(&Time.method(:at)) end |