Class: AhlScraper::GoalieGameListItem

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

Instance Method Summary collapse

Methods inherited from Resource

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

Constructor Details

#initialize(raw_data, opts = {}) ⇒ GoalieGameListItem

Returns a new instance of GoalieGameListItem.



5
6
7
8
# File 'lib/ahl_scraper/resources/goalie_game_list_item.rb', line 5

def initialize(raw_data, opts = {})
  super(raw_data, opts)
  @raw_data = raw_data
end

Instance Method Details

#dateObject



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

def date
  @date ||= @raw_data[:row][:date_played]
end

#game_idObject



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

def game_id
  @game_id ||= @raw_data[:prop][:game][:gameLink].to_i
end

#game_nameObject



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

def game_name
  @game_name ||= @raw_data[:row][:game]
end

#goals_againstObject



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

def goals_against
  @goals_against ||= @raw_data[:row][:goals_against].to_i
end

#goals_against_averageObject



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

def goals_against_average
  @goals_against_average ||= @raw_data[:row][:gaa].to_f
end

#minutesObject



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

def minutes
  @minutes ||= @raw_data[:row][:minutes]
end

#resultObject



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

def result
  @result ||= set_result
end

#save_percentObject



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

def save_percent
  @save_percent ||= @raw_data[:row][:svpct].to_f
end

#savesObject



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

def saves
  @saves ||= @raw_data[:row][:saves].to_i
end

#shots_againstObject



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

def shots_against
  @shots_against ||= @raw_data[:row][:shots_against].to_i
end

#shutout?Boolean

Returns:

  • (Boolean)


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

def shutout?
  @shutout ||= @raw_data[:row][:shutout] == "1"
end