Class: BlendSpreadsheetLoanGenerator::Linear

Inherits:
Object
  • Object
show all
Includes:
SpreadsheetConcern
Defined in:
lib/blend_spreadsheet_loan_generator/linear.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(loan:) ⇒ Linear

Returns a new instance of Linear.



6
7
8
# File 'lib/blend_spreadsheet_loan_generator/linear.rb', line 6

def initialize(loan:)
  @loan = loan
end

Instance Attribute Details

#loanObject

Returns the value of attribute loan.



5
6
7
# File 'lib/blend_spreadsheet_loan_generator/linear.rb', line 5

def loan
  @loan
end

Instance Method Details

#period_calculated_capital_formulaObject



10
11
12
13
14
15
16
17
18
# File 'lib/blend_spreadsheet_loan_generator/linear.rb', line 10

def period_calculated_capital_formula(*)
  amount =
    if loan.deferred_and_capitalized.zero?
      excel_float(loan.amount)
    else
      "(#{capitalized_interests_end(loan.deferred_and_capitalized + 1)} + #{capitalized_fees_end(loan.deferred_and_capitalized + 1)} + #{excel_float(loan.amount)})"
    end
  "=#{amount} / #{loan.non_deferred_duration}"
end