Class: Playoffs::Round

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/playoffs/round.rb

Overview

Represents a group of series that can be played at the same time.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(series) ⇒ Round

Returns a new instance of Round.



13
14
15
# File 'lib/playoffs/round.rb', line 13

def initialize(series)
  @series = series
end

Instance Attribute Details

#seriesObject (readonly)

Returns the value of attribute series.



10
11
12
# File 'lib/playoffs/round.rb', line 10

def series
  @series
end

Instance Method Details

#not_overObject



38
39
40
# File 'lib/playoffs/round.rb', line 38

def not_over
  series.reject(&:over?).sort_by(&:games_played)
end

#not_over?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/playoffs/round.rb', line 33

def not_over?
  !over?
end

#over?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/playoffs/round.rb', line 28

def over?
  not_over.empty?
end

#to_sObject



18
19
20
# File 'lib/playoffs/round.rb', line 18

def to_s
  series.map(&:to_s).join("\n")
end

#up_nextObject



23
24
25
# File 'lib/playoffs/round.rb', line 23

def up_next
  not_over.first
end