class AhlScraper::Games::Skater

Public Instance Methods

birthdate() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 26
def birthdate
  @birthdate ||= valid_birthdate? ? @raw_data[:birthdate] : nil
end
captaincy() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 46
def captaincy
  @captaincy ||= @raw_data[:captaincy]
end
current_age() click to toggle source
# 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_name() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 10
def first_name
  @first_name ||= @raw_data[:first_name]
end
home_team() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 50
def home_team
  @home_team ||= @raw_data[:home_team]
end
id() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 6
def id
  @id ||= @raw_data[:id]
end
jersey_number() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 22
def jersey_number
  @jersey_number ||= @raw_data[:number]
end
last_name() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 14
def last_name
  @last_name ||= @raw_data[:last_name]
end
on_ice() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 71
def on_ice
  @on_ice ||= @opts[:on_ice_statline]
end
penalty() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 75
def penalty
  @penalty ||= @opts[:penalty_statline]
end
penalty_shot() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 79
def penalty_shot
  @penalty_shot ||= @opts[:penalty_shot_statline] || {}
end
position() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 18
def position
  @position ||= @raw_data[:position]
end
scoring() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 67
def scoring
  @scoring ||= @opts[:scoring_statline]
end
shootout() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 83
def shootout
  @shootout ||= @opts[:shootout_statline] || {}
end
shots() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 63
def shots
  @shots ||= { sog_as: @raw_data[:sog_as] }
end
starting() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 42
def starting
  @starting ||= @raw_data[:starting]
end
stats() click to toggle source
# 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_abbreviation() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 38
def team_abbreviation
  @team_abbreviation ||= @raw_data[:team_abbreviation]
end
team_id() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 34
def team_id
  @team_id ||= @raw_data[:team_id]
end

Private Instance Methods

valid_birthdate?() click to toggle source
# File lib/ahl_scraper/resources/games/skater.rb, line 89
def valid_birthdate?
  @valid_birthdate ||= !@raw_data[:birthdate].empty? && @raw_data[:birthdate] != "0000-00-00"
end