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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 618d3364164eaf1ace3bcc3ac97c45e43a2d500d051c5f1df4bb6fcb6c996d44
4
- data.tar.gz: cbef182d16b9ea12ab58fc088f9c2a3de502984e113473b56fdc4e2b7f9740dd
3
+ metadata.gz: d479d818a0375938fac8af2b76798236b0acbdd1074613da808dded2b788af5a
4
+ data.tar.gz: 54d0a3866d06817a3170b878d6b1bd074300334c81ce9c185c463d06682228a4
5
5
  SHA512:
6
- metadata.gz: b76eb4e785d03ea71309bde25517a4f3b164074ceb015cde53e37c9b398c42eae38db3f95509adeae186cf7bfa465a7f1d58cf7bd8453f188f134c88734f154c
7
- data.tar.gz: 6239c5066987b013a0bcbaf0d03bb2b78905fcae65a3f3d35d895251162f7d4ebbbe619467c517ed2ff33566aaacd6079edb04187f443ab05e2d42adb3075d0a
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
@@ -1,7 +1,7 @@
1
1
  require 'dry/cli'
2
2
 
3
3
  module BlendSpreadsheetLoanGenerator
4
- VERSION = '0.1.13'
4
+ VERSION = '0.1.14'.freeze
5
5
 
6
6
  class Version < Dry::CLI::Command
7
7
  desc 'Print version'
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.13
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-05-21 00:00:00.000000000 Z
11
+ date: 2021-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport