Class: FinModeling::WeightedAvgCostOfCapital

Inherits:
Object
  • Object
show all
Defined in:
lib/finmodeling/weighted_avg_cost_of_capital.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(equity_market_val, debt_market_val, cost_of_equity, after_tax_cost_of_debt) ⇒ WeightedAvgCostOfCapital

Returns a new instance of WeightedAvgCostOfCapital.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/finmodeling/weighted_avg_cost_of_capital.rb', line 5

def initialize(equity_market_val, debt_market_val, cost_of_equity, after_tax_cost_of_debt)
  @equity_market_val      = equity_market_val 
  @debt_market_val        = debt_market_val
  @cost_of_equity         = cost_of_equity
  @after_tax_cost_of_debt = after_tax_cost_of_debt

  e_weight = @equity_market_val / (@equity_market_val + @debt_market_val)
  d_weight = @debt_market_val   / (@equity_market_val + @debt_market_val)

  @rate = Rate.new((e_weight * @cost_of_equity.value) + (d_weight * @after_tax_cost_of_debt.value))
end

Instance Attribute Details

#rateObject (readonly)

Returns the value of attribute rate.



3
4
5
# File 'lib/finmodeling/weighted_avg_cost_of_capital.rb', line 3

def rate
  @rate
end

Instance Method Details

#summaryObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/finmodeling/weighted_avg_cost_of_capital.rb', line 17

def summary
  s = CalculationSummary.new
  s.title = "Cost of Capital"
  s.totals_row_enabled = false

  s.header_row = CalculationHeader.new(:key => "", :vals => [Date.today.to_s])

  s.rows = [ ]

  s.rows << CalculationRow.new(:key => "Market Value of Equity ($MM)", :vals => [@equity_market_val.to_nearest_million])
  s.rows << CalculationRow.new(:key => "Market Value of Debt ($MM)", :vals => [@debt_market_val.to_nearest_million])
  s.rows << CalculationRow.new(:key => "Cost of Equity (%)", :vals => [sprintf("%.2f", 100.0*@cost_of_equity.value)])
  s.rows << CalculationRow.new(:key => "Cost of Debt (%)", :vals => [sprintf("%.2f", 100.0*@after_tax_cost_of_debt.value)])
  s.rows << CalculationRow.new(:key => "Weighted Avg Cost of Capital (%)", :vals => [sprintf("%.2f", 100.0*@rate.value)])

  return s
end