string-format 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b29841a689a4ec3e6fba4c7aad34fd683db3ed2b0b012ddd6e63d16b009a1ec4
4
- data.tar.gz: a1b5eba4869899ce137f364b0508d6d4606b13f2d3a940646887272b8080a3c6
3
+ metadata.gz: 1dc27ae95d3d0efc9e330b3844d2e8a98ded08cc775309a99c23fe753eaeb9fa
4
+ data.tar.gz: bd2d9a31bab50d1379d5d6f93bb08d4e44802502b90ae898c0f8c57df09d963a
5
5
  SHA512:
6
- metadata.gz: fd7c94eb13f3809660790154f460c869d21c760d33f941b2e812d22cb66fc037ef182d5eb74e640d64c2fa26476d8ec08e2e7793095b08f867dfa4ea0c775c23
7
- data.tar.gz: 6cbf6163f08194f0b56df5ba03f63d6a2c4aaaaf0b4d614de8626e8cb8ce9a58e9df6046fa4fe6572c86009711d823620ba87cea3ee6d1479518f1a23822b723
6
+ metadata.gz: 56482395708aeff848836d5f07b3779aba7745333457ed0e40c39a1e94f14a6b8d2920d830ffd87141b2d99dc04572da07b9ee2b8a541b38837b34777a7ecd3b
7
+ data.tar.gz: 88ff4bebc80516c10afdc92ba5fbfdf519d969bf49fdd8eaf9d467bcb2c6ed1574fe2d08d2426a48a669597aec0f4ac5eb3ec637bbe581161710271da5a3f89c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -6,8 +6,9 @@
6
6
  module String::Format
7
7
  # Format multiple statistics into a compact string.
8
8
  # @parameter pairs [Hash] Hash of statistic names to values or [current, total] arrays.
9
+ # @parameter short [Boolean] Whether to use short keys (first letter only).
9
10
  # @returns [String] A formatted statistics string.
10
- def statistics(**pairs)
11
+ def statistics(pairs, short: true)
11
12
  pairs.map do |key, value|
12
13
  case value
13
14
  when Array
@@ -16,7 +17,13 @@ module String::Format
16
17
  value = count(value)
17
18
  end
18
19
 
19
- "#{key.to_s.upcase}=#{value}"
20
+ if short
21
+ key = key.to_s[0].upcase
22
+ else
23
+ key = key.to_s.upcase
24
+ end
25
+
26
+ "#{key}=#{value}"
20
27
  end.join(" ")
21
28
  end
22
29
 
@@ -7,6 +7,6 @@
7
7
  class String
8
8
  # @namespace
9
9
  module Format
10
- VERSION = "0.1.0"
10
+ VERSION = "0.2.0"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -14,8 +14,14 @@ Please see the [project documentation](https://socketry.github.io/string-format/
14
14
 
15
15
  Please see the [project releases](https://socketry.github.io/string-format/releases/index) for all releases.
16
16
 
17
+ ### v0.2.0
18
+
19
+ - `String::Format.statistics` takes pairs argument instead of keyword argument.
20
+
17
21
  ### v0.1.0
18
22
 
23
+ - Initial release.
24
+
19
25
  ## Contributing
20
26
 
21
27
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,3 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.2.0
4
+
5
+ - `String::Format.statistics` takes pairs argument instead of keyword argument.
6
+
3
7
  ## v0.1.0
8
+
9
+ - Initial release.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file