Class: AhlScraper::Games::Overtime
- Inherits:
-
Resource
- Object
- Resource
- AhlScraper::Games::Overtime
show all
- Defined in:
- lib/ahl_scraper/resources/games/overtime.rb
Instance Method Summary
collapse
Methods inherited from Resource
#[], #each, #initialize, #inspect, #keys, #to_json, #values
Instance Method Details
#away_goals ⇒ Object
39
40
41
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 39
def away_goals
@away_goals ||= @raw_data[:stats][:visitingGoals].to_i
end
|
#away_sog ⇒ Object
43
44
45
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 43
def away_sog
@away_sog ||= @raw_data[:stats][:visitingShots].to_i
end
|
#home_goals ⇒ Object
31
32
33
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 31
def home_goals
@home_goals ||= @raw_data[:stats][:homeGoals].to_i
end
|
#home_sog ⇒ Object
35
36
37
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 35
def home_sog
@home_sog ||= @raw_data[:stats][:homeShots].to_i
end
|
#length ⇒ Object
14
15
16
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 14
def length
@length ||= ElapsedTimeHelper.new(length_in_seconds).to_min
end
|
#length_in_seconds ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 18
def length_in_seconds
@length_in_seconds ||=
if scoring?
PeriodTimeHelper.new(@raw_data[:goals][0][:time]).to_sec
else
@opts[:regular_season] ? 300 : 1200
end
end
|
#name ⇒ Object
10
11
12
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 10
def name
@name ||= "#{@raw_data[:info][:longName]}#{number}"
end
|
#number ⇒ Object
6
7
8
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 6
def number
@number ||= @raw_data[:info][:id].to_i - 3
end
|
#scoring? ⇒ Boolean
27
28
29
|
# File 'lib/ahl_scraper/resources/games/overtime.rb', line 27
def scoring?
@scoring ||= @raw_data[:goals].any?
end
|