Class: AcpcPokerTypes::ChipStack
- Inherits:
-
Rational
- Object
- Rational
- AcpcPokerTypes::ChipStack
- Defined in:
- lib/acpc_poker_types/chip_stack.rb
Instance Method Summary collapse
- #give!(number_of_chips) ⇒ Object
-
#initialize(number_of_chips = 0) ⇒ ChipStack
constructor
A new instance of ChipStack.
- #receive!(number_of_chips) ⇒ Object
Constructor Details
#initialize(number_of_chips = 0) ⇒ ChipStack
Returns a new instance of ChipStack.
12 13 14 15 16 17 18 |
# File 'lib/acpc_poker_types/chip_stack.rb', line 12 def initialize(number_of_chips=0) @value = number_of_chips.to_r assert_valid_value super @value end |
Instance Method Details
#give!(number_of_chips) ⇒ Object
29 30 31 |
# File 'lib/acpc_poker_types/chip_stack.rb', line 29 def give!(number_of_chips) receive!(-number_of_chips) end |
#receive!(number_of_chips) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/acpc_poker_types/chip_stack.rb', line 20 def receive!(number_of_chips) @value += number_of_chips assert_valid_value __setobj__ @value self end |