Class: Seat
- Inherits:
-
Object
- Object
- Seat
- Defined in:
- lib/rora/model/seat.rb
Overview
A seat at a poker table.
Once a table is constructed, each seat at the table will contain a reference to the seat before it and the seat after it. In effect, the seat implements a very basic doubly-linked list.
Instance Attribute Summary collapse
-
#button ⇒ Object
Returns the value of attribute button.
-
#next ⇒ Object
Returns the value of attribute next.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#player ⇒ Object
Returns the value of attribute player.
-
#prev ⇒ Object
Returns the value of attribute prev.
Instance Method Summary collapse
-
#button? ⇒ Boolean
Determines whether this seat has the dealer button.
-
#initialize(number) ⇒ Seat
constructor
A new instance of Seat.
-
#taken? ⇒ Boolean
Determines whether the seat is taken.
- #to_s ⇒ Object
Constructor Details
#initialize(number) ⇒ Seat
Returns a new instance of Seat.
12 13 14 15 |
# File 'lib/rora/model/seat.rb', line 12 def initialize number raise ArgumentError, "Must create a seat number with a value of 1 or greater" if number < 1 @number = number end |
Instance Attribute Details
#button ⇒ Object
Returns the value of attribute button.
9 10 11 |
# File 'lib/rora/model/seat.rb', line 9 def @button end |
#next ⇒ Object
Returns the value of attribute next.
9 10 11 |
# File 'lib/rora/model/seat.rb', line 9 def next @next end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
10 11 12 |
# File 'lib/rora/model/seat.rb', line 10 def number @number end |
#player ⇒ Object
Returns the value of attribute player.
9 10 11 |
# File 'lib/rora/model/seat.rb', line 9 def player @player end |
#prev ⇒ Object
Returns the value of attribute prev.
9 10 11 |
# File 'lib/rora/model/seat.rb', line 9 def prev @prev end |
Instance Method Details
#button? ⇒ Boolean
Determines whether this seat has the dealer button.
23 24 25 |
# File 'lib/rora/model/seat.rb', line 23 def return !.nil? end |
#taken? ⇒ Boolean
Determines whether the seat is taken.
18 19 20 |
# File 'lib/rora/model/seat.rb', line 18 def taken? return !@player.nil? end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/rora/model/seat.rb', line 27 def to_s "Seat: #{@number}" end |