subunit 0.7.0 → 0.8.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/subunit.rb +24 -4
- metadata +2 -2
- 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: 4466d231e3c336adf393301ac33736362e1ba2996bfa0a42f2ca56be949ffbff
|
4
|
+
data.tar.gz: daff11e883761163e31f79d431f91ad1ad10790f613359a0aa593a29da82a57a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd3f645fc57ea4badfbc121d02ba36edc240b063bebb468804dfe5a451b9d6abf084b3c59cc346302fad9e2fbda381aa82831f677789ac6c8bfd99b305dbf9fd
|
7
|
+
data.tar.gz: 2fefff70fc6f6144c2f4fc5c0c691bd354ce42f770478ad8c8c93e8860175d833021900fc2b84ef6a363bd45eda21ef8dd4d4bb9b4fa83632425609d8f0e69db
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/subunit.rb
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
# file: subunit.rb
|
4
4
|
|
5
|
+
module SubunitFracture
|
6
|
+
|
7
|
+
refine Integer do
|
8
|
+
|
9
|
+
def strfunit(s)
|
10
|
+
Subunit.seconds(self).strfunit(s)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
5
17
|
class Subunit
|
6
18
|
|
7
19
|
def self.seconds(val)
|
@@ -16,13 +28,22 @@ class Subunit
|
|
16
28
|
|
17
29
|
@raw_units = raw_units
|
18
30
|
|
19
|
-
|
20
|
-
|
31
|
+
|
32
|
+
accumulate = ->(obj) {
|
21
33
|
a = obj[0..-2]
|
22
34
|
len = raw_units.to_a.length
|
23
35
|
val = ([0]*(len-1) + a).slice(-(len), len).zip(raw_units.values)\
|
24
36
|
.inject(0) {|r,x| r + x.inject(:*) }
|
25
|
-
|
37
|
+
val + obj[-1]
|
38
|
+
}
|
39
|
+
|
40
|
+
if obj.is_a? String
|
41
|
+
|
42
|
+
@to_i = accumulate.call obj.split(' ').map(&:to_i)
|
43
|
+
|
44
|
+
elsif obj.is_a? Array then
|
45
|
+
|
46
|
+
@to_i = accumulate.call obj
|
26
47
|
|
27
48
|
else
|
28
49
|
|
@@ -149,4 +170,3 @@ class Subunit
|
|
149
170
|
unit_list.length > 0 ? [unit] + scan_units(unit_list, subunit) : [unit, subunit]
|
150
171
|
end
|
151
172
|
end
|
152
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subunit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
HowcHg4GymtLLITCF/QtA5tta5SmHAca1POGncsO9QiramFQ9S3Q4O4wcjboVJOp
|
36
36
|
SSxk4InmYoY9Cl2GVQ+d9owo
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
38
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
40
|
description:
|
41
41
|
email: james@jamesrobertson.eu
|
metadata.gz.sig
CHANGED
Binary file
|