Class: Playoffs::Round
- Inherits:
-
Object
- Object
- Playoffs::Round
- 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
-
#series ⇒ Object
readonly
Returns the value of attribute series.
Instance Method Summary collapse
-
#initialize(series) ⇒ Round
constructor
A new instance of Round.
- #not_over ⇒ Object
- #not_over? ⇒ Boolean
- #over? ⇒ Boolean
- #to_s ⇒ Object
- #up_next ⇒ Object
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
#series ⇒ Object (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_over ⇒ Object
38 39 40 |
# File 'lib/playoffs/round.rb', line 38 def not_over series.reject(&:over?).sort_by(&:games_played) end |
#not_over? ⇒ Boolean
33 34 35 |
# File 'lib/playoffs/round.rb', line 33 def not_over? !over? end |
#over? ⇒ Boolean
28 29 30 |
# File 'lib/playoffs/round.rb', line 28 def over? not_over.empty? end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/playoffs/round.rb', line 18 def to_s series.map(&:to_s).join("\n") end |
#up_next ⇒ Object
23 24 25 |
# File 'lib/playoffs/round.rb', line 23 def up_next not_over.first end |