Class: AhlScraper::Games::TeamOnIceGoalsService

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

Instance Method Summary collapse

Constructor Details

#initialize(team_id, goal_data) ⇒ TeamOnIceGoalsService

Returns a new instance of TeamOnIceGoalsService.



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

def initialize(team_id, goal_data)
  @team_id = team_id
  @goal_data = goal_data
end

Instance Method Details

#callObject



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

def call
  @on_ice_statline = generate_on_ice_statline
  @goal_data.each do |goal|
    @team_id == goal[:team][:id] ? goal_for(goal) : goal_against(goal)
  end

  @on_ice_statline
end