Class: ScraperLeague::Game
- Inherits:
-
Object
- Object
- ScraperLeague::Game
- Defined in:
- lib/vegas_insider_scraper/scraper_league.rb
Instance Attribute Summary collapse
-
#ats_winner ⇒ Object
readonly
Returns the value of attribute ats_winner.
-
#away_team ⇒ Object
readonly
Returns the value of attribute away_team.
-
#doubleheader ⇒ Object
readonly
Returns the value of attribute doubleheader.
-
#ending ⇒ Object
readonly
Returns the value of attribute ending.
-
#home_team ⇒ Object
readonly
Returns the value of attribute home_team.
-
#losing_score ⇒ Object
readonly
Returns the value of attribute losing_score.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#over_under_result ⇒ Object
readonly
Returns the value of attribute over_under_result.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#vegas_info ⇒ Object
readonly
Returns the value of attribute vegas_info.
-
#winning_score ⇒ Object
readonly
Returns the value of attribute winning_score.
-
#winning_team ⇒ Object
readonly
Returns the value of attribute winning_team.
Instance Method Summary collapse
- #==(other_game) ⇒ Object
- #as_json ⇒ Object
- #find_equal(games) ⇒ Object
- #home_or_away_team(team) ⇒ Object
-
#initialize(args = {}) ⇒ Game
constructor
A new instance of Game.
- #teams_found? ⇒ Boolean
- #update(args = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#ats_winner ⇒ Object (readonly)
Returns the value of attribute ats_winner.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def ats_winner @ats_winner end |
#away_team ⇒ Object (readonly)
Returns the value of attribute away_team.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def away_team @away_team end |
#doubleheader ⇒ Object (readonly)
Returns the value of attribute doubleheader.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def doubleheader @doubleheader end |
#ending ⇒ Object (readonly)
Returns the value of attribute ending.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def ending @ending end |
#home_team ⇒ Object (readonly)
Returns the value of attribute home_team.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def home_team @home_team end |
#losing_score ⇒ Object (readonly)
Returns the value of attribute losing_score.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def losing_score @losing_score end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def notes @notes end |
#over_under_result ⇒ Object (readonly)
Returns the value of attribute over_under_result.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def over_under_result @over_under_result end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def time @time end |
#vegas_info ⇒ Object (readonly)
Returns the value of attribute vegas_info.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def vegas_info @vegas_info end |
#winning_score ⇒ Object (readonly)
Returns the value of attribute winning_score.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def winning_score @winning_score end |
#winning_team ⇒ Object (readonly)
Returns the value of attribute winning_team.
653 654 655 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 653 def winning_team @winning_team end |
Instance Method Details
#==(other_game) ⇒ Object
677 678 679 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 677 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 ⇒ Object
688 689 690 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 688 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) ⇒ Object
673 674 675 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 673 def find_equal(games) games.detect { |g| g == self } end |
#home_or_away_team(team) ⇒ Object
681 682 683 684 685 686 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 681 def home_or_away_team(team) case team when home_team then :home when away_team then :away else nil end end |
#teams_found? ⇒ Boolean
669 670 671 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 669 def teams_found? home_team && away_team end |
#update(args = {}) ⇒ Object
661 662 663 664 665 666 667 |
# File 'lib/vegas_insider_scraper/scraper_league.rb', line 661 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 |