Class: Baron::Company::PrivateCompany

Inherits:
Baron::Company show all
Defined in:
lib/baron/company/private_company.rb

Overview

A private company represents a single certificate company which can be owned by a single player or company. It has a face value, and provides a fixed income to the player every operating round.

Instance Attribute Summary collapse

Attributes inherited from Baron::Company

#abbreviation, #name

Instance Method Summary collapse

Methods inherited from Baron::Company

#to_s

Methods included from Shareholder

#add_transaction, #balance, #certificates, #certificates_for, #directorships, #give, #grant, #largest_train, #percentage_owned, #private_certificates, #trains

Constructor Details

#initialize(abbreviation, name, face_value:, revenue:) ⇒ PrivateCompany

Initialize the private company

Examples:

Baron::Company::PrivateCompany.new(
  'company',
  'P1',
  face_value: Baron::Money.new(100),
  revenue: Baron::Money.new(10)
)

Parameters:


43
44
45
46
47
# File 'lib/baron/company/private_company.rb', line 43

def initialize(abbreviation, name, face_value:, revenue:)
  super(abbreviation, name)
  @face_value = face_value
  @revenue = revenue
end

Instance Attribute Details

#face_valueBaron::Money (readonly)

The face value of the company

Examples:

private_company.face_value #=> $100

Returns:


15
16
17
# File 'lib/baron/company/private_company.rb', line 15

def face_value
  @face_value
end

#revenueBaron::Money (readonly)

The recurring revenue earned every operating round

This revenue is paid during the private turn phase of the turn.

Examples:

private_company.revenue #=> $10

Returns:


26
27
28
# File 'lib/baron/company/private_company.rb', line 26

def revenue
  @revenue
end