Class: SportsDataApi::Ncaamb::Games
- Inherits:
-
Object
- Object
- SportsDataApi::Ncaamb::Games
- Includes:
- Enumerable
- Defined in:
- lib/sports_data_api/ncaamb/games.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#games ⇒ Object
readonly
Returns the value of attribute games.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(xml) ⇒ Games
constructor
A new instance of Games.
Constructor Details
#initialize(xml) ⇒ Games
Returns a new instance of Games.
7 8 9 10 11 12 13 |
# File 'lib/sports_data_api/ncaamb/games.rb', line 7 def initialize(xml) @date = xml.first['date'] @games = xml.xpath("games/game").map do |game_xml| Game.new(date: @date, xml: game_xml) end end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
5 6 7 |
# File 'lib/sports_data_api/ncaamb/games.rb', line 5 def date @date end |
#games ⇒ Object (readonly)
Returns the value of attribute games.
5 6 7 |
# File 'lib/sports_data_api/ncaamb/games.rb', line 5 def games @games end |
Instance Method Details
#each(&block) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/sports_data_api/ncaamb/games.rb', line 15 def each &block @games.each do |game| if block_given? block.call game else yield game end end end |