Class: AhlScraper::Games::TimeSplitsService

Inherits:
Object
  • Object
show all
Defined in:
lib/ahl_scraper/services/games/time_splits_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(goals, team_id, current_state, game_properties) ⇒ TimeSplitsService

Returns a new instance of TimeSplitsService.



6
7
8
9
10
11
# File 'lib/ahl_scraper/services/games/time_splits_service.rb', line 6

def initialize(goals, team_id, current_state, game_properties)
  @goals = goals
  @team_id = team_id
  @current_state = current_state
  @game_properties = game_properties
end

Instance Method Details

#callObject



13
14
15
16
17
18
# File 'lib/ahl_scraper/services/games/time_splits_service.rb', line 13

def call
  @times = { leading: 0, trailing: 0, tied: 0 }
  @time_elapsed = @game_properties[:game_start_time_in_seconds] || 0
  calculate_time_splits
  @times
end