makit 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/makit/humanize.rb +15 -2
- data/lib/makit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6907ebf24a2329adf0bba41970b506e5b1a21d0459c82a0c44aa721946015c42
|
4
|
+
data.tar.gz: 36276973efd109200ea9448bbf9a072d3f43f4c983d28b71f520442f0dcb9b96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fecfe917f1dd787788af641b4b15a63a7f94dfe44b6efa0f008c1a8f90db5e1f61dc580a9a4fdb558f940c7b858138049e7912af094433a3c2b58aa49d884a2d
|
7
|
+
data.tar.gz: eade8504dd9d374edf17095af9a74dd10341c6092e861c1208a135f8973d5a6a9adf302245383d2849362c7397cf496d99dfd8612f0a5bd539f7a8badf14104f
|
data/lib/makit/humanize.rb
CHANGED
@@ -86,8 +86,21 @@ module Makit
|
|
86
86
|
"#{hours}h #{minutes}m #{seconds}s"
|
87
87
|
end
|
88
88
|
|
89
|
-
def self.get_humanized_duration(
|
90
|
-
|
89
|
+
def self.get_humanized_duration(seconds)
|
90
|
+
minutes = (seconds / 60).to_i
|
91
|
+
seconds = (seconds % 60).to_i
|
92
|
+
hours = (minutes / 60).to_i
|
93
|
+
minutes = minutes % 60
|
94
|
+
days = (hours / 24).to_i
|
95
|
+
hours = hours % 24
|
96
|
+
|
97
|
+
parts = []
|
98
|
+
parts << "#{days} days" if days > 0
|
99
|
+
parts << "#{hours} hours" if hours > 0
|
100
|
+
parts << "#{minutes} minutes" if minutes > 0
|
101
|
+
parts << "#{seconds} seconds" if seconds > 0
|
102
|
+
|
103
|
+
parts.join(", ")
|
91
104
|
end
|
92
105
|
end
|
93
106
|
end
|
data/lib/makit/version.rb
CHANGED