loan_creator 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/loan_creator/common.rb +3 -2
- data/lib/loan_creator/term_dates_validator.rb +5 -3
- data/lib/loan_creator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 838d0d280c585125b013b8ea6d7e8b58e94c2234fffe3d49d1c97f39a67b254f
|
4
|
+
data.tar.gz: 7a607035130b53af6678bdec2a91b9d99fcace0a1710db1ef83333a4b15133b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
|
data/lib/loan_creator/common.rb
CHANGED
@@ -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]
|
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
|
-
|
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"
|
data/lib/loan_creator/version.rb
CHANGED
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.
|
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-
|
15
|
+
date: 2021-05-26 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|