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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05e0a96288811e72dc2eb9e6a3661999169c6651ebbc02947821b5b53134b5f2
4
- data.tar.gz: 9e633f27f93ffa5b75234e41598c0ba5def872d7fd42295dfea8eebb476e381a
3
+ metadata.gz: 10d3c0d79a87e3a7a92abf69915f5835b4973e43de6eca90e9bdcdb91f1f0838
4
+ data.tar.gz: 9458bdc26b15ec704e49163621acabab67f59fa6f4cb64d531183d1c58e2523b
5
5
  SHA512:
6
- metadata.gz: b91c849fa49ecabd48a0db83d33418bf470c8597db5fc66b6e538b393fe88dde1f1d3f8d285334494761ddf5bc416b630df8d404aa400b2488f3bf206de56b21
7
- data.tar.gz: 0bcbc3591c087a60bb0f52601a7a0afe0653d695fb4f8807ecd43565565416ad8cb26b151a3ad8ec59cb1f157840ec5ec3cb7e4c9aa7b2e7e1c413a8484e7e64
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
@@ -24,7 +24,7 @@ module Foobara
24
24
  end
25
25
 
26
26
  def all_symbolic_elements?(array)
27
- array.all? { |key| key.is_a?(Symbol) || key.is_a?(String) }
27
+ array.all? { |key| key.is_a?(Symbol) }
28
28
  end
29
29
 
30
30
  def all_symbolizable_elements?(array)
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi