blend_spreadsheet_loan_generator 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blend_spreadsheet_loan_generator/concerns/csv_concern.rb +21 -0
- data/lib/blend_spreadsheet_loan_generator/early_repay.rb +1 -0
- data/lib/blend_spreadsheet_loan_generator/realistic_interests.rb +0 -1
- data/lib/blend_spreadsheet_loan_generator/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: d479d818a0375938fac8af2b76798236b0acbdd1074613da808dded2b788af5a
|
4
|
+
data.tar.gz: 54d0a3866d06817a3170b878d6b1bd074300334c81ce9c185c463d06682228a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e29bcf2a06bb55675c1b9e5cc90457d23a60b23a7670908ac0361bc8be56cb4f7e4cbd762909f6d51d7092a06734f54a723db2da1a95396700090bb6a6af2572
|
7
|
+
data.tar.gz: 400f763cb728b85c541429b36d892f328d1fa19ef003b78ff06aa0ad0dbb60bc56b6f2bf59c951a5b00b2a9af2e479cb3bdb14802634c86c81afa6709ac8bcc0
|
@@ -27,3 +27,24 @@ module BlendSpreadsheetLoanGenerator
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
|
32
|
+
def generate_csv(data:, name:)
|
33
|
+
CSV.open(name, 'wb') do |csv|
|
34
|
+
data.each do |datum|
|
35
|
+
row = []
|
36
|
+
datum.each.with_index do |value, index|
|
37
|
+
row << (
|
38
|
+
if index == 0
|
39
|
+
value.to_i
|
40
|
+
elsif index == 1
|
41
|
+
Date.parse(value).strftime('%m/%d/%Y')
|
42
|
+
else
|
43
|
+
value.gsub(',', '.').to_f
|
44
|
+
end
|
45
|
+
)
|
46
|
+
end
|
47
|
+
csv << row
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -12,6 +12,7 @@ module BlendSpreadsheetLoanGenerator
|
|
12
12
|
argument :from_path, type: :string, required: true, desc: 'csv to restructure'
|
13
13
|
argument :rate, type: :float, required: true, desc: 'year rate post restructuration'
|
14
14
|
|
15
|
+
option :duration, type: :integer, desc: 'duration'
|
15
16
|
option :period_duration, type: :integer, default: 1, desc: 'duration of a period in months'
|
16
17
|
option :due_on, type: :date, default: Date.today, desc: 'date of the pay day of the first period DD/MM/YYYY'
|
17
18
|
option :deferred_and_capitalized, type: :integer, default: 0, desc: 'periods with no capital or interests paid'
|
@@ -11,7 +11,6 @@ module BlendSpreadsheetLoanGenerator
|
|
11
11
|
"=#{excel_float(loan.rate)} * ((#{period_leap_days(line)} / 366) + (#{period_non_leap_days(line)} / 365))"
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
14
|
def period_fees_rate_formula(line:)
|
16
15
|
"=#{excel_float(loan.fees_rate)} * ((#{period_leap_days(line)} / 366) + (#{period_non_leap_days(line)} / 365))"
|
17
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blend_spreadsheet_loan_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MZiserman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|