class AhlScraper::Games::PenaltyShot
Public Instance Methods
game_time_elapsed()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 53 def game_time_elapsed @game_time_elapsed ||= period_time.to_elapsed end
goalie()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 20 def goalie @goalie ||= { id: @raw_data[:goalie][:id], first_name: @raw_data[:goalie][:firstName], last_name: @raw_data[:goalie][:lastName], jersey_number: @raw_data[:goalie][:jerseyNumber], position: @raw_data[:goalie][:position], } end
number()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 6 def number @number ||= @opts[:number] end
period()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 41 def period @period ||= @raw_data[:period][:id].to_i end
period_time_in_seconds()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 49 def period_time_in_seconds @period_time_in_seconds ||= period_time.to_sec end
scored?()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 57 def scored? @scored ||= @raw_data[:isGoal] == true end
scored_in_words()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 61 def scored_in_words @scored_in_words ||= if scored? "Scored" else "Missed" end end
shooter()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 10 def shooter @shooter ||= { id: @raw_data[:shooter][:id], first_name: @raw_data[:shooter][:firstName], last_name: @raw_data[:shooter][:lastName], jersey_number: @raw_data[:shooter][:jerseyNumber], position: @raw_data[:shooter][:position], } end
shooting_team()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 30 def shooting_team @shooting_team ||= { id: @raw_data[:shooter_team][:id], full_name: @raw_data[:shooter_team][:name], city: @raw_data[:shooter_team][:city], name: @raw_data[:shooter_team][:nickname], abbreviation: @raw_data[:shooter_team][:abbreviation], logo_url: @raw_data[:shooter_team][:logo], } end
time()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 45 def time @time ||= @raw_data[:time] end
Private Instance Methods
convert_time(game_time)
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 76 def convert_time(game_time) time = game_time.split(":") time[0].to_i * 60 + time[1].to_i end
period_time()
click to toggle source
# File lib/ahl_scraper/resources/games/penalty_shot.rb, line 72 def period_time @period_time ||= PeriodTimeHelper.new(time, period) end