Class: Bagel::Tennis::Checker
- Inherits:
-
Object
- Object
- Bagel::Tennis::Checker
- Defined in:
- lib/bagel/tennis/checker.rb
Constant Summary collapse
- BREAK_POINT =
'BREAK POINT'
- SET_POINT =
'SET POINT'
- MATCH_POINT =
'MATCH POINT'
- MINIMUM_POINTS_TO_WIN_GAME =
4
- MINIMUM_POINTS_TO_WIN_TIEBREAK =
7
- MINIMUM_GAMES_TO_WIN_SET =
6
- SETS_TO_WIN_MATCH =
2
- TIEBREAK_AT =
[ MINIMUM_GAMES_TO_WIN_SET, MINIMUM_GAMES_TO_WIN_SET ]
Instance Attribute Summary collapse
-
#points ⇒ Object
readonly
Returns the value of attribute points.
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#sets ⇒ Object
readonly
Returns the value of attribute sets.
Instance Method Summary collapse
- #break_point? ⇒ Boolean
-
#initialize(sets:, points:, server:) ⇒ Checker
constructor
A new instance of Checker.
- #match_point? ⇒ Boolean
- #set_point? ⇒ Boolean
- #tiebreak? ⇒ Boolean
Constructor Details
Instance Attribute Details
#points ⇒ Object (readonly)
Returns the value of attribute points.
15 16 17 |
# File 'lib/bagel/tennis/checker.rb', line 15 def points @points end |
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
15 16 17 |
# File 'lib/bagel/tennis/checker.rb', line 15 def receiver @receiver end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
15 16 17 |
# File 'lib/bagel/tennis/checker.rb', line 15 def server @server end |
#sets ⇒ Object (readonly)
Returns the value of attribute sets.
15 16 17 |
# File 'lib/bagel/tennis/checker.rb', line 15 def sets @sets end |
Instance Method Details
#break_point? ⇒ Boolean
22 23 24 |
# File 'lib/bagel/tennis/checker.rb', line 22 def break_point? next_point_wins_game?(receiver) end |
#match_point? ⇒ Boolean
30 31 32 |
# File 'lib/bagel/tennis/checker.rb', line 30 def match_point? next_point_wins_match?(server) || next_point_wins_match?(receiver) end |
#set_point? ⇒ Boolean
26 27 28 |
# File 'lib/bagel/tennis/checker.rb', line 26 def set_point? next_point_wins_set?(server) || next_point_wins_set?(receiver) end |
#tiebreak? ⇒ Boolean
34 35 36 |
# File 'lib/bagel/tennis/checker.rb', line 34 def tiebreak? sets.last == Tennis::Checker::TIEBREAK_AT end |