Class: Baron::UnavailableCertificatesPool

Inherits:
Object
  • Object
show all
Includes:
Shareholder
Defined in:
lib/baron/unavailable_certificates_pool.rb

Overview

The unavailable certificates pool will store companies that can't be purchased for whatever reason. Examples would be shares in companies that can't be purchased, because they haven't been started.

Instance Method Summary collapse

Methods included from Shareholder

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

Instance Method Details

#inspectString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a string representation of the pool

Returns:

  • (String)

59
60
61
# File 'lib/baron/unavailable_certificates_pool.rb', line 59

def inspect
  "#<Baron::UnavailableCertificatesPool:#{object_id}>"
end

#make_certificate_available(certificate, initial_offering) ⇒ void

This method returns an undefined value.

Makes a specific certificate available

Examples:

unavailable_certificates_pool.make_certificate_available

Parameters:


40
41
42
# File 'lib/baron/unavailable_certificates_pool.rb', line 40

def make_certificate_available(certificate, initial_offering)
  give initial_offering, certificate
end

#make_company_available(company, initial_offering) ⇒ void

This method returns an undefined value.

Makes a company certificate available to the pool

If the company is a major company, it will transfer its directors certificate to the pool, otherwise it will transfer the private comapny certificate to the pool.

Examples:

unavailable_certificates_pool.make_company_available(
  company, initial_offering
)

Parameters:


24
25
26
27
28
29
# File 'lib/baron/unavailable_certificates_pool.rb', line 24

def make_company_available(company, initial_offering)
  make_certificate_available(
    find_controlling_certificate(company),
    initial_offering
  )
end

#next_trainsArray<Baron::Train>

The next set of trains to be available

Examples:

pool.next_trains

Returns:


51
52
53
# File 'lib/baron/unavailable_certificates_pool.rb', line 51

def next_trains
  trains.select { |train| train.type.equal? next_train_type }
end