Class: Baron::Action::SellCertificates

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

Overview

Sell one or more certificates to the bank for the current market price

Instance Attribute Summary

Attributes inherited from Baron::Action

#player

Instance Method Summary collapse

Methods inherited from Baron::Action

#process, #symbol

Constructor Details

#initialize(player, bank, market, certificates) ⇒ SellCertificates

Create the sell certificates action

Examples:

Baron::Action::SellCertificates.new(player, bank, certificates)

Parameters:


16
17
18
19
20
21
# File 'lib/baron/action/sell_certificates.rb', line 16

def initialize(player, bank, market, certificates)
  @player = player
  @bank = bank
  @market = market
  @certificates = certificates
end

Instance Method Details

#create_transactionvoid

This method returns an undefined value.

Create the transaction to transfer the certificates to the bank

The player will receive the appropriate value of each of the certificates

Examples:

sell_certificates.create_transaction

33
34
35
36
37
38
39
40
41
# File 'lib/baron/action/sell_certificates.rb', line 33

def create_transaction
  Transaction.new(
    @bank,
    @certificates,
    player,
    [proceeds]
  )
  reduce_prices
end