Class: Scoreboard

Inherits:
Object
  • Object
show all
Defined in:
lib/scoreboard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dayObject

Returns the value of attribute day.



6
7
8
# File 'lib/scoreboard.rb', line 6

def day
  @day
end

#gamesObject

An array of Game objects representing all of the games played on this date



5
6
7
# File 'lib/scoreboard.rb', line 5

def games
  @games
end

#monthObject

Returns the value of attribute month.



6
7
8
# File 'lib/scoreboard.rb', line 6

def month
  @month
end

#yearObject

Returns the value of attribute year.



6
7
8
# File 'lib/scoreboard.rb', line 6

def year
  @year
end

Instance Method Details

#load_for_date(year, month, day) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/scoreboard.rb', line 8

def load_for_date(year, month, day)
  @games = []
  @year = year
  @month = month
  @day = day
  @xml_data = GamedayFetcher.fetch_scoreboard(year, month, day)
  @xml_doc = REXML::Document.new(@xml_data)
  
  @xml_doc.elements.each("games/game") { |element|
    game = Game.new(element.attributes['gameday'])
    game.load_from_scoreboard(element)
    @games << game
  }
end