class ScraperLeague::Game
Attributes
ats_winner[R]
away_team[R]
doubleheader[R]
ending[R]
home_team[R]
losing_score[R]
notes[R]
over_under_result[R]
time[R]
vegas_info[R]
winning_score[R]
winning_team[R]
Public Class Methods
new(args = {})
click to toggle source
# File lib/vegas_insider_scraper/scraper_league.rb, line 665 def initialize(args = {}) Game.sanitize(args).map { |attribute, value| instance_variable_set("@#{attribute}", value) } end
Private Class Methods
sanitize(args)
click to toggle source
# File lib/vegas_insider_scraper/scraper_league.rb, line 701 def self.sanitize(args) permitted_keys = [:time, :away_team, :home_team, :vegas_info, :ending, :winning_team, :winning_score, :losing_score, :ats_winner, :over_under_result, :doubleheader, :notes] args.select { |key,_| permitted_keys.include? key } end
Public Instance Methods
==(other_game)
click to toggle source
# File lib/vegas_insider_scraper/scraper_league.rb, line 685 def ==(other_game) home_team == other_game.home_team && away_team == other_game.away_team && time.to_date == other_game.time.to_date && doubleheader == other_game.doubleheader end
as_json()
click to toggle source
# File lib/vegas_insider_scraper/scraper_league.rb, line 696 def as_json instance_variables.each_with_object({}) { |var, hash| hash[var.to_s.delete("@").to_sym] = instance_variable_get(var) } end
find_equal(games)
click to toggle source
# File lib/vegas_insider_scraper/scraper_league.rb, line 681 def find_equal(games) games.detect { |g| g == self } end
home_or_away_team(team)
click to toggle source
# File lib/vegas_insider_scraper/scraper_league.rb, line 689 def home_or_away_team(team) case team when home_team then :home when away_team then :away else nil end end
teams_found?()
click to toggle source
# File lib/vegas_insider_scraper/scraper_league.rb, line 677 def teams_found? home_team && away_team end
update(args = {})
click to toggle source
# File lib/vegas_insider_scraper/scraper_league.rb, line 669 def update(args = {}) Game.sanitize(args).map { |attribute, value| new_val = (attribute == :vegas_info && value && vegas_info) ? value.merge(vegas_info) : value instance_variable_set("@#{attribute}", new_val) } return self end