Class: AhlScraper::Games::Skater

Inherits:
Resource
  • Object
show all
Defined in:
lib/ahl_scraper/resources/games/skater.rb

Instance Method Summary collapse

Methods inherited from Resource

#[], #each, #initialize, #inspect, #keys, #to_json, #values

Constructor Details

This class inherits a constructor from AhlScraper::Resource

Instance Method Details

#birthdateObject



26
27
28
# File 'lib/ahl_scraper/resources/games/skater.rb', line 26

def birthdate
  @birthdate ||= valid_birthdate? ? @raw_data[:birthdate] : nil
end

#captaincyObject



46
47
48
# File 'lib/ahl_scraper/resources/games/skater.rb', line 46

def captaincy
  @captaincy ||= @raw_data[:captaincy]
end

#current_ageObject



30
31
32
# File 'lib/ahl_scraper/resources/games/skater.rb', line 30

def current_age
  @current_age ||= valid_birthdate? ? BirthdateHelper.new(birthdate).age_on_date(@opts[:game_date]) : nil
end

#first_nameObject



10
11
12
# File 'lib/ahl_scraper/resources/games/skater.rb', line 10

def first_name
  @first_name ||= @raw_data[:first_name]
end

#home_teamObject



50
51
52
# File 'lib/ahl_scraper/resources/games/skater.rb', line 50

def home_team
  @home_team ||= @raw_data[:home_team]
end

#idObject



6
7
8
# File 'lib/ahl_scraper/resources/games/skater.rb', line 6

def id
  @id ||= @raw_data[:id]
end

#jersey_numberObject



22
23
24
# File 'lib/ahl_scraper/resources/games/skater.rb', line 22

def jersey_number
  @jersey_number ||= @raw_data[:number]
end

#last_nameObject



14
15
16
# File 'lib/ahl_scraper/resources/games/skater.rb', line 14

def last_name
  @last_name ||= @raw_data[:last_name]
end

#on_iceObject



71
72
73
# File 'lib/ahl_scraper/resources/games/skater.rb', line 71

def on_ice
  @on_ice ||= @opts[:on_ice_statline]
end

#penaltyObject



75
76
77
# File 'lib/ahl_scraper/resources/games/skater.rb', line 75

def penalty
  @penalty ||= @opts[:penalty_statline]
end

#penalty_shotObject



79
80
81
# File 'lib/ahl_scraper/resources/games/skater.rb', line 79

def penalty_shot
  @penalty_shot ||= @opts[:penalty_shot_statline] || {}
end

#positionObject



18
19
20
# File 'lib/ahl_scraper/resources/games/skater.rb', line 18

def position
  @position ||= @raw_data[:position]
end

#scoringObject



67
68
69
# File 'lib/ahl_scraper/resources/games/skater.rb', line 67

def scoring
  @scoring ||= @opts[:scoring_statline]
end

#shootoutObject



83
84
85
# File 'lib/ahl_scraper/resources/games/skater.rb', line 83

def shootout
  @shootout ||= @opts[:shootout_statline] || {}
end

#shotsObject



63
64
65
# File 'lib/ahl_scraper/resources/games/skater.rb', line 63

def shots
  @shots ||= { sog_as: @raw_data[:sog_as] }
end

#startingObject



42
43
44
# File 'lib/ahl_scraper/resources/games/skater.rb', line 42

def starting
  @starting ||= @raw_data[:starting]
end

#statsObject



54
55
56
57
58
59
60
61
# File 'lib/ahl_scraper/resources/games/skater.rb', line 54

def stats
  @stats ||= {
    faceoff_attempts: @raw_data[:faceoff_attempts],
    faceoff_wins: @raw_data[:faceoff_wins],
    hits: @raw_data[:hits],
    penalty_minutes: @raw_data[:penalty_minutes],
  }
end

#team_abbreviationObject



38
39
40
# File 'lib/ahl_scraper/resources/games/skater.rb', line 38

def team_abbreviation
  @team_abbreviation ||= @raw_data[:team_abbreviation]
end

#team_idObject



34
35
36
# File 'lib/ahl_scraper/resources/games/skater.rb', line 34

def team_id
  @team_id ||= @raw_data[:team_id]
end