Class: ScoreScraper::Scraper
- Inherits:
-
Object
- Object
- ScoreScraper::Scraper
- Defined in:
- lib/score_scraper/scraper.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(search_date = nil, teams = []) ⇒ Scraper
constructor
A new instance of Scraper.
- #team_games ⇒ Object
Constructor Details
#initialize(search_date = nil, teams = []) ⇒ Scraper
Returns a new instance of Scraper.
3 4 5 6 |
# File 'lib/score_scraper/scraper.rb', line 3 def initialize(search_date = nil, teams = []) @teams = teams @search_date = search_date || Time.now.strftime("%Y-%m-%d") end |
Instance Method Details
#team_games ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/score_scraper/scraper.rb', line 8 def team_games team_games = [] (games || []).each do |game| if teams.empty? || is_team_game?(game) team_games << ScoreScraper::Game.new({ home_team: home_team(game), away_team: away_team(game), game_state: game_state(game) }) end end team_games end |