Class: SportsDataApi::Ncaafb::Games

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sports_data_api/ncaafb/games.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(year, season, week, games_hash) ⇒ Games



7
8
9
10
11
12
13
14
15
# File 'lib/sports_data_api/ncaafb/games.rb', line 7

def initialize(year, season, week, games_hash)
  @year = year
  @season = season
  @week = week

  @games = games_hash['games'].map do |game_hash|
    Game.new(@year, @season, @week, game_hash)
  end
end

Instance Attribute Details

#gamesObject (readonly)

Returns the value of attribute games.



5
6
7
# File 'lib/sports_data_api/ncaafb/games.rb', line 5

def games
  @games
end

#seasonObject (readonly)

Returns the value of attribute season.



5
6
7
# File 'lib/sports_data_api/ncaafb/games.rb', line 5

def season
  @season
end

#weekObject (readonly)

Returns the value of attribute week.



5
6
7
# File 'lib/sports_data_api/ncaafb/games.rb', line 5

def week
  @week
end

#yearObject (readonly)

Returns the value of attribute year.



5
6
7
# File 'lib/sports_data_api/ncaafb/games.rb', line 5

def year
  @year
end

Instance Method Details

#each(&block) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/sports_data_api/ncaafb/games.rb', line 17

def each &block
  @games.each do |game|
    if block_given?
      block.call game
    else
      yield game
    end
  end
end