Class: AhlScraper::PlayoffBrackets::Round

Inherits:
Resource
  • Object
show all
Defined in:
lib/ahl_scraper/resources/playoff_brackets/round.rb

Instance Method Summary collapse

Methods inherited from Resource

#[], #each, #initialize, #inspect, #keys, #to_json, #values

Constructor Details

This class inherits a constructor from AhlScraper::Resource

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 35

def active?
  @active = series.map(&:active?).any?(true) if @active.nil?
  @active
end

#finished?Boolean

Returns:

  • (Boolean)


40
41
42
43
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 40

def finished?
  @finished = series.map(&:finished?).none?(false) && !active? if @finished.nil?
  @finished
end

#idObject



6
7
8
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 6

def id
  @id ||= @raw_data[:round].to_i
end

#nameObject



10
11
12
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 10

def name
  @name ||= @raw_data[:round_name]
end

#round_type_idObject



18
19
20
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 18

def round_type_id
  @round_type_id ||= @raw_data[:round_type_id].to_i
end

#round_type_nameObject



22
23
24
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 22

def round_type_name
  @round_type_name ||= @raw_data[:round_type_name]
end

#season_idObject



14
15
16
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 14

def season_id
  @season_id ||= @raw_data[:season_id].to_i
end

#seriesObject



26
27
28
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 26

def series
  @series ||= @raw_data[:matchups].map { |series| Series.new(series, { bracket_data: @opts[:bracket_data] }) }
end

#started?Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/ahl_scraper/resources/playoff_brackets/round.rb', line 30

def started?
  @started = active? || finished? if @started.nil?
  @started
end