subunit 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/subunit.rb +8 -5
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04ff09dc79844ac6e631550fb7d3af0cd8a7253a6da25b37f4620f4ca2d0af2d
|
4
|
+
data.tar.gz: cdcb4a05cf28aef86d445e2abc3dedd9e735358e7b19ec27b272ba776dd6acc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f110323bf0bc4a33cbd62c43896fe6abc786320348ead1205a3422ffc827d25135681ce02300ee868e6f9ace6d69cc03bf2efa6010f992d33c76576778b37afd
|
7
|
+
data.tar.gz: b811c7fe06ecb53916f406a1d607ceb75b08345955d874cf754540d8b9e75c4de707a6f854932c9bed35a828141f96506e37dabb28f05a8e8fe544c44ffad91c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/subunit.rb
CHANGED
@@ -20,6 +20,10 @@ class Subunit
|
|
20
20
|
new(units={minutes:60, hours:60}, seconds: val)
|
21
21
|
end
|
22
22
|
|
23
|
+
def self.hms_to_seconds(obj)
|
24
|
+
new(units={hours:60, minutes:60,seconds: 60, }, obj).to_i
|
25
|
+
end
|
26
|
+
|
23
27
|
attr_reader :to_a, :to_h, :to_i
|
24
28
|
|
25
29
|
def initialize(raw_units={}, obj)
|
@@ -27,14 +31,12 @@ class Subunit
|
|
27
31
|
@debug = false
|
28
32
|
|
29
33
|
@raw_units = raw_units
|
34
|
+
|
35
|
+
accumulate = ->(a) {
|
30
36
|
|
31
|
-
|
32
|
-
accumulate = ->(obj) {
|
33
|
-
a = obj[0..-2]
|
34
37
|
len = raw_units.to_a.length
|
35
38
|
val = ([0]*(len-1) + a).slice(-(len), len).zip(raw_units.values)\
|
36
|
-
.inject(0) {|r,x| r + x
|
37
|
-
val + obj[-1]
|
39
|
+
.inject(0) {|r,x| r * x[1] + x[0] }
|
38
40
|
}
|
39
41
|
|
40
42
|
if obj.is_a? String
|
@@ -170,3 +172,4 @@ class Subunit
|
|
170
172
|
unit_list.length > 0 ? [unit] + scan_units(unit_list, subunit) : [unit, subunit]
|
171
173
|
end
|
172
174
|
end
|
175
|
+
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|