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 +4 -4
- data/lib/financial_maths/version.rb +1 -1
- data/lib/financial_maths.rb +29 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b7d9c0aeeaa44bb7ee6e161241c6bee0e337bc9
|
4
|
+
data.tar.gz: 68055d248eae238733232afb43e196a45c283253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d8077281558f7943cce5c3712a9aba0d0d8bb287d28bf17beae4adebfe58ab5dc6bdc41184ab6d1a900f442a57d36dc2a46a27f1bfe071acd5e0ec85666774b
|
7
|
+
data.tar.gz: 21263e17d5ca0ca7e7c2512bdc407caf20a608f32477ce1445b56e1a870d1ac2e812304d2e53a27677a98ee11fa48267a4f28802d3bced5933532131b2e559d8
|
data/lib/financial_maths.rb
CHANGED
@@ -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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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.
|
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-
|
12
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|