Class: FinModeling::DebtCostOfCapital

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

Class Method Summary collapse

Class Method Details

.calculate(opts) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/finmodeling/debt_cost_of_capital.rb', line 3

def self.calculate(opts)
  case 
  when  opts[:after_tax_cost] && !opts[:before_tax_cost] && !opts[:marginal_tax_rate]
    Rate.new(opts[:after_tax_cost].value)
  when !opts[:after_tax_cost] &&  opts[:before_tax_cost] &&  opts[:marginal_tax_rate]
    Rate.new(opts[:before_tax_cost].value * (1.0 - (opts[:marginal_tax_rate].value)))
  else
    raise ArgumentError
  end
end