subunit 0.8.3 → 0.8.4
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 +16 -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: 55e24efd3496c6090f8b887857fbefd3dc2a76f4a61fb4a8c3a6f19490bfa153
|
4
|
+
data.tar.gz: fd0af0f6e4fd910898141aa6c7bc13049cd2cd728ba4a9e19a5ab5a8cf9bf558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c2ff98f077a42af3dffc3788961f99bd98fb6643c5987f472e640094a485c138a8a4065a0832c98f27fd4b578d3e0972f1c5ae44a019014471e5cb2ef8e5bc1
|
7
|
+
data.tar.gz: 9ea37778dd9fe8cf32278572a70d4d188ee9b59a460e5e8139bc2e2ff28a13a8055d71d79a7205738c2504fdf595e76ab29c5825f7b749db392a30dedd8a784b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/subunit.rb
CHANGED
@@ -63,20 +63,32 @@ class Subunit
|
|
63
63
|
# .strfunit("%x") #=> 11m 1s
|
64
64
|
#
|
65
65
|
# %x e.g. 11m 1s
|
66
|
+
# %xi e.g. 11m
|
66
67
|
# %X e.g. 11 minutes 1 second
|
68
|
+
# %Xi e.g. 11 minutes
|
67
69
|
# %c e.g. 00:11:01
|
68
70
|
# %s e.g. 11m # returns the 1st most significant value while
|
69
71
|
# ignoring the remainder
|
70
72
|
#
|
71
73
|
def strfunit(s)
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
+
# The i switch postfixed to the x or X switch will format the output
|
76
|
+
# without seconds unless there are no minutes.
|
77
|
+
|
78
|
+
s.sub!(/%xi?/) do |x|
|
79
|
+
|
80
|
+
a = to_h.to_a
|
81
|
+
a2 = (a.length > 1 and x[-1][/i$/]) ? a[0..-2] : a
|
82
|
+
a2.map {|label, val| val.to_s + label[0]}.join(' ')
|
83
|
+
|
75
84
|
end
|
76
85
|
|
77
|
-
s.sub!(
|
86
|
+
s.sub!(/%Xi?/) do |x|
|
87
|
+
|
88
|
+
a = to_h.to_a
|
89
|
+
a2 = (a.length > 1 and x[-1][/i$/]) ? a[0..-2] : a
|
78
90
|
|
79
|
-
|
91
|
+
a2.map do |label, val|
|
80
92
|
|
81
93
|
next if val == 0
|
82
94
|
label2 = val > 1 ? label.to_s : label.to_s.sub(/s$/,'')
|
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.8.
|
4
|
+
version: 0.8.4
|
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: 2021-
|
38
|
+
date: 2021-04-07 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
40
|
description:
|
41
41
|
email: james@jamesrobertson.eu
|
metadata.gz.sig
CHANGED
Binary file
|