loan_creator 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e207b2a1a30e9f07b773f9d3071c8df1cb815e17602661efb72d4315ead65dba
4
- data.tar.gz: c6760d02448a8a9bd6f40fa992aa09f1d716a06b94e2ce5afa8b54eddfeeddf6
3
+ metadata.gz: 838d0d280c585125b013b8ea6d7e8b58e94c2234fffe3d49d1c97f39a67b254f
4
+ data.tar.gz: 7a607035130b53af6678bdec2a91b9d99fcace0a1710db1ef83333a4b15133b0
5
5
  SHA512:
6
- metadata.gz: 75d786838e61c1f342da8a3ebf3e0264e42f0e80909bc22ffe63f5c76acf4a1c36e1130ebcbcb4f8c72d87f7a99735c8e3d70f634889935dd57849f92bcdf98d
7
- data.tar.gz: 768182d707c17e9f5b1f8f748f6dcaf1277e1a1bf0b68c33ed28a178464117272e8dfe294585baeac3fa1d9fb3f28945e1224b7e158fffea66bda89c5cb25dff
6
+ metadata.gz: 06c8e0dfa135c8a80f9969f60db83a8bc3630161fea4f208dff6480ab9142635d196aaa729fdb32fd89e38e87804cbc76fcc1f10ec464c680c10219ef7aec23c
7
+ data.tar.gz: c710e04d68debd3d7f63569586aed46ac1426aabf9ed995fa762a18745916d1f31339f93b173159ddd61dcf23b145527471dbc7ff873a1bdfc46169e310f4322
data/README.md CHANGED
@@ -187,7 +187,7 @@ Default: `false`.
187
187
  The default behaviour is to use the `period` in relation to the number of months in a year (ie: for a monthly timetable annual_interests_rate * 1/12, for quarter annual_interests_rate * 3/12, etc.)
188
188
 
189
189
 
190
- `term_dates`: Optional. Implemented for `LoanCreator::Bullet`, `LoanCreator::InFine` and `LoanCreator::Linear`. Can be used if you want to implement custom due dates for terms. Terms will be compute from date to date. Must be an array with following dates.
190
+ `term_dates`: Optional. Implemented for `LoanCreator::Bullet`, `LoanCreator::InFine` and `LoanCreator::Linear`. Can be used if you want to implement custom due dates for terms. Terms will be computed from date to date. Must be an array with following dates. Must contain duration + 1 dates. The first element of the array is the first period start_date and last is the last period pay day.
191
191
 
192
192
  ## Calculation
193
193
 
@@ -291,10 +291,11 @@ module LoanCreator
291
291
 
292
292
  def prepare_custom_term_dates
293
293
  term_dates = @options[:term_dates].each_with_index.with_object({}) do |(term_date, index), obj|
294
- obj[index + 1] = term_date
294
+ obj[index + @starting_index - 1] = term_date
295
295
  end
296
296
 
297
- term_dates[0] = starts_on
297
+ # if starting_index > 1 term_dates[0] is not set
298
+ term_dates[0] ||= starts_on
298
299
  @_timetable_term_dates = term_dates
299
300
  @realistic_durations = true
300
301
  end
@@ -17,8 +17,10 @@ module LoanCreator
17
17
  end
18
18
 
19
19
  def self.matches_duration(term_dates, duration_in_periods)
20
- unless term_dates.size == duration_in_periods
21
- raise ArgumentError, "the size of :term_dates (#{term_dates.size}) do not match the :duration_in_periods (#{duration_in_periods})"
20
+ unless term_dates.size == duration_in_periods + 1
21
+ error_message = "the size of :term_dates (#{term_dates.size}) do not match the :duration_in_periods (#{duration_in_periods})."
22
+ advice = "You must pass the previous term date (or start_on if starting_index == 1) as the first term date"
23
+ raise ArgumentError, "#{error_message} #{advice}"
22
24
  end
23
25
  end
24
26
 
@@ -64,7 +66,7 @@ module LoanCreator
64
66
  raise ArgumentError, "term dates can't be more than 1 year apart. #{error_description}"
65
67
  end
66
68
  end
67
- end
69
+ end
68
70
 
69
71
  def self.bullet?(loan_class)
70
72
  loan_class == "LoanCreator::Bullet"
@@ -1,3 +1,3 @@
1
1
  module LoanCreator
2
- VERSION = '0.9.1'.freeze
2
+ VERSION = '0.10.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loan_creator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thibaulth
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2021-05-11 00:00:00.000000000 Z
15
+ date: 2021-05-26 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler