Class: Baron::Action::Bid

Inherits:
Baron::Action show all
Defined in:
lib/baron/action/bid.rb

Overview

A bid is made on an auction, by a player in a specific amount.

Constant Summary collapse

BID_INCREMENT =

Minimum bid increment

5

Instance Attribute Summary collapse

Attributes inherited from Baron::Action

#player

Instance Method Summary collapse

Methods inherited from Baron::Action

#process, #symbol

Constructor Details

#initialize(player, amount) ⇒ Bid

Create the bid

Examples:

Baron::Action::Bid.new(player, Baron::Money.new(20))

Parameters:


26
27
28
29
30
31
# File 'lib/baron/action/bid.rb', line 26

def initialize(player, amount)
  super(player)
  @amount = amount
  validate_non_negative
  validate_divisibility
end

Instance Attribute Details

#amountBaron::Money (readonly)

The amount bid

Examples:

bid.amount

Returns:


16
17
18
# File 'lib/baron/action/bid.rb', line 16

def amount
  @amount
end