financial_maths 0.0.10 → 0.0.11

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
  SHA1:
3
- metadata.gz: 13c87971dac11e54b8ea062a728043248cc9dd7c
4
- data.tar.gz: 00f5e26cb70ecd67eeb78d6622958788f9e98385
3
+ metadata.gz: 2b7d9c0aeeaa44bb7ee6e161241c6bee0e337bc9
4
+ data.tar.gz: 68055d248eae238733232afb43e196a45c283253
5
5
  SHA512:
6
- metadata.gz: eea9ef44b4d44ef4119e7f50be408914b252ad23f75db5401da959c7db0558ee2b8495df92b36c8ce15a3f968150940fa4ec5ceea3fb36dc7b6a4e5ce3e0f2de
7
- data.tar.gz: b449f2d0c6659624799fb57b49c2da4653f9f95333e2dbfe6161a5628c807403b00dfba119a491e8bc319cfbcb7eb69387bdec6cd20a326924038550cd39a206
6
+ metadata.gz: 0d8077281558f7943cce5c3712a9aba0d0d8bb287d28bf17beae4adebfe58ab5dc6bdc41184ab6d1a900f442a57d36dc2a46a27f1bfe071acd5e0ec85666774b
7
+ data.tar.gz: 21263e17d5ca0ca7e7c2512bdc407caf20a608f32477ce1445b56e1a870d1ac2e812304d2e53a27677a98ee11fa48267a4f28802d3bced5933532131b2e559d8
@@ -1,3 +1,3 @@
1
1
  module FinancialMaths
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -7,10 +7,15 @@ module FinancialMaths
7
7
  result << {:period=> 0, :monthly_payment => nil, :interest => nil, :payment => nil, :balance => amount}
8
8
 
9
9
  for i in 1..periods
10
- interest = amount * rate
11
- month_payment = payment + interest
12
- amount -= payment
13
- #date += 1
10
+ if i == periods
11
+ interest = month_payment * rate
12
+ month_payment = payment + interest
13
+ amount -= payment
14
+ else
15
+ interest = amount * rate
16
+ month_payment = payment + interest
17
+ amount -= payment
18
+ end
14
19
  result << {:period=> i,
15
20
  :payment => month_payment,
16
21
  :interest => interest,
@@ -25,10 +30,16 @@ module FinancialMaths
25
30
  #result << {:period=> 0, :monthly_payment => nil, :interest => nil, :payment => nil, :balance => amount}
26
31
 
27
32
  for i in 0..periods-1
28
- interest = amount * rate
29
- month_payment = payment + interest
30
- amount -= payment
31
- #date += 1
33
+ if i == periods
34
+ interest = month_payment * rate
35
+ month_payment = payment + interest
36
+ amount -= payment
37
+ else
38
+ interest = amount * rate
39
+ month_payment = payment + interest
40
+ amount -= payment
41
+ end
42
+
32
43
  result << {:period=> i,
33
44
  :payment => month_payment,
34
45
  :interest => interest,
@@ -44,10 +55,16 @@ module FinancialMaths
44
55
  result << {:period=> 0, :monthly_payment => nil, :interest => nil, :payment => nil, :balance => amount}
45
56
 
46
57
  for i in 1..periods
47
- interest = amount * rate
48
- month_payment = payment - interest
49
- amount -= month_payment
50
- #date += 1
58
+ if i == periods
59
+ interest = month_payment * rate
60
+ month_payment = payment - interest
61
+ amount -= payment
62
+ else
63
+ interest = amount * rate
64
+ month_payment = payment - interest
65
+ amount -= payment
66
+ end
67
+
51
68
  result << {:period=> i,
52
69
  :payment => payment,
53
70
  :interest => interest,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: financial_maths
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Espinosa
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-10 00:00:00.000000000 Z
12
+ date: 2014-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler