Class: BlendSpreadsheetLoanGenerator::RealisticInterests

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(loan:) ⇒ RealisticInterests

Returns a new instance of RealisticInterests.



6
7
8
# File 'lib/blend_spreadsheet_loan_generator/realistic_interests.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/realistic_interests.rb', line 5

def loan
  @loan
end

Instance Method Details

#period_fees_rate_formula(line:) ⇒ Object



14
15
16
# File 'lib/blend_spreadsheet_loan_generator/realistic_interests.rb', line 14

def period_fees_rate_formula(line:)
  "=#{excel_float(loan.fees_rate)} * ((#{period_leap_days(line)} / 366) + (#{period_non_leap_days(line)} / 365))"
end

#period_rate_formula(line:) ⇒ Object



10
11
12
# File 'lib/blend_spreadsheet_loan_generator/realistic_interests.rb', line 10

def period_rate_formula(line:)
  "=#{excel_float(loan.rate)} * ((#{period_leap_days(line)} / 366) + (#{period_non_leap_days(line)} / 365))"
end