Class: Pot

Inherits:
Object
  • Object
show all
Defined in:
lib/rora/model/pot.rb

Overview

The sum of money that players wager during a single hand or game.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePot

Returns a new instance of Pot.



7
8
9
# File 'lib/rora/model/pot.rb', line 7

def initialize
  @value = 0
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/rora/model/pot.rb', line 5

def value
  @value
end

Instance Method Details

#add(bet) ⇒ Object

Adds the specified bet to the pot

Raises:

  • (ArgumentError)


12
13
14
15
16
# File 'lib/rora/model/pot.rb', line 12

def add bet
  raise ArgumentError, "Can only add positive values" if bet < 0
  @value += bet
  self
end

#to_sObject



18
19
20
# File 'lib/rora/model/pot.rb', line 18

def to_s
  "Pot: " + sprintf("$%.02f" , @value)
end