Class: BlendSpreadsheetLoanGenerator::Linear
- Inherits:
-
Object
- Object
- BlendSpreadsheetLoanGenerator::Linear
- Includes:
- SpreadsheetConcern
- Defined in:
- lib/blend_spreadsheet_loan_generator/linear.rb
Instance Attribute Summary collapse
-
#loan ⇒ Object
Returns the value of attribute loan.
Instance Method Summary collapse
-
#initialize(loan:) ⇒ Linear
constructor
A new instance of Linear.
- #period_calculated_capital_formula ⇒ Object
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
#loan ⇒ Object
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_formula ⇒ Object
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 |