checkpercentage 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/checkpercentage.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21383b5431b4212ff2f889a232962131ba469ca2
|
4
|
+
data.tar.gz: dc515dbc1ccb8c267bbaa5cb943ca167fd55a43e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 134fd4cd344294ff4a3317713a4f01f3497616544bdbfe7098042f962328effa64d14c26bb55301c4ee0208dd50eda51d9f1073545bdac52ce3d33182047d7c8
|
7
|
+
data.tar.gz: 1a98477a38072dbffabc91a37f9d410bfd5b45da14b8d9e0156081fffc734aa61ee5d64d320e035c1ec5ed152b74b8587feb86633b86e7a3873bf65692a00297
|
data/lib/checkpercentage.rb
CHANGED
@@ -8,13 +8,13 @@ class Checkpercentage
|
|
8
8
|
|
9
9
|
#2) x is what percentage of y?
|
10
10
|
def self.find_percent(amount, base)
|
11
|
-
|
11
|
+
result_percent = (amount.to_f.round(2)/base.to_f.round(2) * 100).ceil
|
12
12
|
return result_percent
|
13
13
|
end
|
14
14
|
|
15
15
|
#3) x is y% of what number?
|
16
16
|
def self.find_base(amount, rate)
|
17
|
-
result_base = amount/rate * 100
|
17
|
+
result_base = (amount.to_f.round(2)/rate.to_f.round(2) * 100).ceil
|
18
18
|
return result_base
|
19
19
|
end
|
20
20
|
|