Method: Finance::Amortization#duration

Defined in:
lib/finance/amortization.rb

#durationInteger

Returns the time required to pay off the loan, in months.

Examples:

In most cases, the duration is equal to the total duration of all rates

rate = Rate.new(0.0375, :apr, :duration => (30 * 12))
amt = 300000.amortize(rate)
amt.duration #=> 360

Extra payments may reduce the duration

rate = Rate.new(0.0375, :apr, :duration => (30 * 12))
amt = 300000.amortize(rate){ |payment| payment.amount-100}
amt.duration #=> 319

Returns:

  • (Integer)

    the time required to pay off the loan, in months



122
123
124
# File 'lib/finance/amortization.rb', line 122

def duration
  self.payments.length
end