Class: SportsDataApi::Nfl::Quarters

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sports_data_api/nfl/quarters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(quarters_hash) ⇒ Quarters

Returns a new instance of Quarters.



7
8
9
10
11
# File 'lib/sports_data_api/nfl/quarters.rb', line 7

def initialize(quarters_hash)
  @quarters = quarters_hash.map do |quarter|
    Quarter.new(quarter)
  end
end

Instance Attribute Details

#quartersObject (readonly)

Returns the value of attribute quarters.



5
6
7
# File 'lib/sports_data_api/nfl/quarters.rb', line 5

def quarters
  @quarters
end

Instance Method Details

#each(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/sports_data_api/nfl/quarters.rb', line 13

def each &block
  quarters.each do |quarter|
    if block_given?
      block.call quarter
    else
      yield quarter
    end
  end
end