Class: InterestDays::Calculation::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/interest_days/calculation/base.rb

Overview

Base calculation class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_date:, end_date:) ⇒ Base

Returns a new instance of Base.



16
17
18
19
20
21
# File 'lib/interest_days/calculation/base.rb', line 16

def initialize(start_date:, end_date:)
  @start_date = start_date
  @end_date = end_date

  raise StartDateBeforeEndDateError if start_date_after_end_date?
end

Instance Attribute Details

#end_dateObject (readonly)

Returns the value of attribute end_date.



14
15
16
# File 'lib/interest_days/calculation/base.rb', line 14

def end_date
  @end_date
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



14
15
16
# File 'lib/interest_days/calculation/base.rb', line 14

def start_date
  @start_date
end

Instance Method Details

#day_count_factorObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/interest_days/calculation/base.rb', line 23

def day_count_factor
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}"
end