class AhlScraper::GoalieGameListItem

Public Class Methods

new(raw_data) click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 5
def initialize(raw_data)
  @raw_data = raw_data
end

Public Instance Methods

date() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 17
def date
  @date ||= @raw_data[:row][:date_played]
end
game_id() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 9
def game_id
  @game_id ||= @raw_data[:prop][:game][:gameLink].to_i
end
game_name() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 13
def game_name
  @game_name ||= @raw_data[:row][:game]
end
goals_against() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 21
def goals_against
  @goals_against ||= @raw_data[:row][:goals_against].to_i
end
goals_against_average() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 33
def goals_against_average
  @goals_against_average ||= @raw_data[:row][:gaa].to_f
end
minutes() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 41
def minutes
  @minutes ||= @raw_data[:row][:minutes]
end
result() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 45
def result
  @result ||= set_result
end
save_percent() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 37
def save_percent
  @save_percent ||= @raw_data[:row][:svpct].to_f
end
saves() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 29
def saves
  @saves ||= @raw_data[:row][:saves].to_i
end
shots_against() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 25
def shots_against
  @shots_against ||= @raw_data[:row][:shots_against].to_i
end
shutout?() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 49
def shutout?
  @shutout ||= @raw_data[:row][:shutout] == "1"
end

Private Instance Methods

set_result() click to toggle source
# File lib/ahl_scraper/resources/goalie_game_list_item.rb, line 55
def set_result
  return "won" if @raw_data[:row][:win] == "1"

  # return "so_loss" if @raw_data[:row][:so_loss] == "1"

  return "ot_loss" if @raw_data[:row][:ot_loss] == "1"

  return "loss" if @raw_data[:row][:loss] == "1"

  return "played_but_no_result" if @raw_data[:row][:minutes] != "0:00"

  "did_not_play"
end