Class: AhlScraper::Games::PenaltyShotStatlinesService
- Inherits:
-
Object
- Object
- AhlScraper::Games::PenaltyShotStatlinesService
- Defined in:
- lib/ahl_scraper/services/games/penalty_shot_statlines_service.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(penalty_shot_data, team_id, skater_ids) ⇒ PenaltyShotStatlinesService
constructor
A new instance of PenaltyShotStatlinesService.
Constructor Details
#initialize(penalty_shot_data, team_id, skater_ids) ⇒ PenaltyShotStatlinesService
Returns a new instance of PenaltyShotStatlinesService.
6 7 8 9 10 |
# File 'lib/ahl_scraper/services/games/penalty_shot_statlines_service.rb', line 6 def initialize(penalty_shot_data, team_id, skater_ids) @penalty_shot_data = penalty_shot_data @team_id = team_id @skater_ids = skater_ids end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ahl_scraper/services/games/penalty_shot_statlines_service.rb', line 12 def call @penalty_shot_data.each do |penalty_shot| skater_id = penalty_shot[:shooter][:id].to_s penalty_shot_statlines[skater_id] ||= blank_statline penalty_shot_statlines[skater_id][:attempts] += 1 penalty_shot_statlines[skater_id][:goals] += 1 if penalty_shot[:isGoal] end penalty_shot_statlines end |