foobara-util 1.0.6 → 1.0.7
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
- data/CHANGELOG.md +5 -0
- data/lib/foobara/util/array.rb +1 -1
- data/lib/foobara/util/hash.rb +18 -0
- 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: 10d3c0d79a87e3a7a92abf69915f5835b4973e43de6eca90e9bdcdb91f1f0838
|
|
4
|
+
data.tar.gz: 9458bdc26b15ec704e49163621acabab67f59fa6f4cb64d531183d1c58e2523b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26fea39e3fedef82f906e526bd5fd52bb744ced65b6099d912ad60a69a0b2803527b00315de7a2477554c1d51d2c95841b04ad890d21b3d1ffd1f222b3f78e8d
|
|
7
|
+
data.tar.gz: 716bdb5a05215ec218f0edfef4e64c6e7bc792fce8854eed3c301244a1d15d21d2a06f835eb73abdf9342445ef0ea2a70f7eec75ec6f092ce34f277a377a6033
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [1.0.7] - 2025-12-19
|
|
2
|
+
|
|
3
|
+
- Fix bug where .all_symbolic_keys? would return true for a hash with a string key
|
|
4
|
+
- Handle situations where Hash subclass or non-Hash are passed to .symbolize_keys
|
|
5
|
+
|
|
1
6
|
## [1.0.6] - 2025-12-14
|
|
2
7
|
|
|
3
8
|
- Make sure constants come out in a deterministic order across various systems
|
data/lib/foobara/util/array.rb
CHANGED
data/lib/foobara/util/hash.rb
CHANGED
|
@@ -9,6 +9,16 @@ module Foobara
|
|
|
9
9
|
# :nocov:
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
unless hash.instance_of?(::Hash)
|
|
13
|
+
unless hash.respond_to?(:to_h)
|
|
14
|
+
# :nocov:
|
|
15
|
+
raise ArgumentError, "Could not turn #{hash} into an instance of Hash"
|
|
16
|
+
# :nocov:
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
hash = hash.to_h
|
|
20
|
+
end
|
|
21
|
+
|
|
12
22
|
hash.transform_keys(&:to_sym)
|
|
13
23
|
end
|
|
14
24
|
|
|
@@ -20,6 +30,14 @@ module Foobara
|
|
|
20
30
|
end
|
|
21
31
|
|
|
22
32
|
hash.transform_keys!(&:to_sym)
|
|
33
|
+
|
|
34
|
+
unless hash.instance_of?(::Hash)
|
|
35
|
+
unless all_symbolic_keys?(hash)
|
|
36
|
+
raise ArgumentError, "Cannot symbolize keys for #{hash} because it isn't behaving like a Hash"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
hash
|
|
23
41
|
end
|
|
24
42
|
|
|
25
43
|
def all_symbolic_keys?(hash)
|