Class: Sportradar::Nhl::Models::ScoringPlayer

Inherits:
PlayPlayerStat show all
Defined in:
lib/sportradar/nhl/models/scoring_player.rb

Instance Method Summary collapse

Methods inherited from PlayPlayerStat

#clock, #description, #event, #event_id, #full_name, #goal?, #initialize, #jersey, #penalty?, #period, #period_abbreviation, #period_number, #period_sequence, #period_type, #player, #player_id, #saved?, #shootout?, #stat, #strength, #team, #team_id, #team_market, #team_name, #type, #win?, #zone

Constructor Details

This class inherits a constructor from Sportradar::Nhl::Models::PlayPlayerStat

Instance Method Details

#roleObject



5
6
7
8
9
10
11
12
13
# File 'lib/sportradar/nhl/models/scoring_player.rb', line 5

def role
  if goal? && type == 'shot'
    'scorer'
  elsif goal? && type == 'shotagainst' && !saved?
    'goalie'
  else
    type
  end
end

#scoring_play_idObject



15
16
17
# File 'lib/sportradar/nhl/models/scoring_player.rb', line 15

def scoring_play_id
  event.id
end

#to_sObject



19
20
21
# File 'lib/sportradar/nhl/models/scoring_player.rb', line 19

def to_s
  "#{super} - #{role}"
end