financial_maths 0.0.11 → 0.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b7d9c0aeeaa44bb7ee6e161241c6bee0e337bc9
4
- data.tar.gz: 68055d248eae238733232afb43e196a45c283253
3
+ metadata.gz: 2bbd02c7bf4024c740d7d75a566d285665c96c03
4
+ data.tar.gz: dd22d4cec4aca97f2090ea5284a4f80262705a2a
5
5
  SHA512:
6
- metadata.gz: 0d8077281558f7943cce5c3712a9aba0d0d8bb287d28bf17beae4adebfe58ab5dc6bdc41184ab6d1a900f442a57d36dc2a46a27f1bfe071acd5e0ec85666774b
7
- data.tar.gz: 21263e17d5ca0ca7e7c2512bdc407caf20a608f32477ce1445b56e1a870d1ac2e812304d2e53a27677a98ee11fa48267a4f28802d3bced5933532131b2e559d8
6
+ metadata.gz: 9266448a212e1ae9930d7cbf61c602c3ecbd0a8b94106a95c50cd231385d8e69f917680b4157f659dbc30eacf39ac534386889ecf15f35c9c15c5571089b7ba0
7
+ data.tar.gz: 227e513b3dd9e2b7b84caccbded7de61f5665447d25ca95e0ee500675418dcf1ae43c46b158677ed1b19252a1ea5416c4ca13f777f4b4c27d0afeac632906f21
@@ -1,3 +1,3 @@
1
1
  module FinancialMaths
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -7,13 +7,11 @@ 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
10
12
  if i == periods
11
- interest = month_payment * rate
12
- month_payment = payment + interest
13
- amount -= payment
13
+ amount -= amount
14
14
  else
15
- interest = amount * rate
16
- month_payment = payment + interest
17
15
  amount -= payment
18
16
  end
19
17
  result << {:period=> i,
@@ -30,16 +28,15 @@ module FinancialMaths
30
28
  #result << {:period=> 0, :monthly_payment => nil, :interest => nil, :payment => nil, :balance => amount}
31
29
 
32
30
  for i in 0..periods-1
31
+ interest = amount * rate
32
+ month_payment = payment + interest
33
33
  if i == periods
34
- interest = month_payment * rate
35
- month_payment = payment + interest
36
- amount -= payment
34
+ amount -= amount
37
35
  else
38
- interest = amount * rate
39
- month_payment = payment + interest
40
36
  amount -= payment
41
37
  end
42
38
 
39
+ #date += 1
43
40
  result << {:period=> i,
44
41
  :payment => month_payment,
45
42
  :interest => interest,
@@ -55,16 +52,15 @@ module FinancialMaths
55
52
  result << {:period=> 0, :monthly_payment => nil, :interest => nil, :payment => nil, :balance => amount}
56
53
 
57
54
  for i in 1..periods
55
+ interest = amount * rate
56
+ month_payment = payment - interest
58
57
  if i == periods
59
- interest = month_payment * rate
60
- month_payment = payment - interest
61
- amount -= payment
58
+ amount -= amount
62
59
  else
63
- interest = amount * rate
64
- month_payment = payment - interest
65
- amount -= payment
60
+ amount -= month_payment
66
61
  end
67
-
62
+
63
+ #date += 1
68
64
  result << {:period=> i,
69
65
  :payment => payment,
70
66
  :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.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Espinosa