optify-config 1.3.0-aarch64-linux → 1.3.1-aarch64-linux

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: 034ea3406d9abddf721a9bf996e316c237bffb8d1a3a4c60dd6cfcf11d810256
4
- data.tar.gz: 8d295a6002b969dac15b2621c3ee5b092450067fd3710c80e910b09b143991f6
3
+ metadata.gz: '0584860cb164993589247381ec3f8df8f0df6c4fae557a2e4d9bbbb1e1337ca0'
4
+ data.tar.gz: 6cd44b25dc514c1504935af0c663a3ef405f521f6bd96bae351af4c270393c42
5
5
  SHA512:
6
- metadata.gz: 1ec9a5b790be0fb4153bfc49d7d9afb17182bf240eac27e8378e88f8b16e10c05f1f87b311460e2464a7cc72ee53f7f84a93063a1b85c6f0c204880938d316f5
7
- data.tar.gz: 175d1586630d1766ed03b3399447734a0778c77da584ac9e19488b6e64e38f7662f50ceef319a9d44594b060d8a41ddf129110e9924b356088e57e5efb1a192f
6
+ metadata.gz: a1a237f9f4fa18d1a2ff7c1f4b5a7acb360332f197130c487ce4a58681e5ca060e0f82156aabdfdcacf8199b48fbee4ac7fc9318f4beae2797d3328ce1d99452
7
+ data.tar.gz: 393c684e66b0525128adcccac86e52980ad08ac64ddf2bfea3e6ea18f9457a69a2fe705e90a8b86069e190c061f8da7783b4d85faf5fd2855d8fa2da5c1ae0a0
Binary file
Binary file
@@ -41,6 +41,8 @@ module Optify
41
41
  return value
42
42
  end
43
43
 
44
+ return value.to_sym if type.is_a?(T::Types::Simple) && type.raw_type == Symbol
45
+
44
46
  case value
45
47
  when Array
46
48
  # Handle `T.nilable(T::Array[...])`
@@ -77,18 +79,16 @@ module Optify
77
79
  return type_for_hash.from_hash(hash) if type_for_hash.respond_to?(:from_hash)
78
80
  elsif type.is_a?(T::Types::TypedHash)
79
81
  # The hash should be a hash, but the values might be objects to convert.
80
- type_for_values = type.values
82
+ type_for_keys = type.keys
81
83
 
82
- if type_for_values.respond_to?(:raw_type)
83
- raw_type_for_values = T.unsafe(type_for_values).raw_type
84
- if raw_type_for_values.respond_to?(:from_hash)
85
- # Use proper types.
86
- return hash.transform_values { |v| raw_type_for_values.from_hash(v) }
87
- end
88
- end
84
+ convert_key = if type_for_keys.is_a?(T::Types::Simple) && type_for_keys.raw_type == Symbol
85
+ lambda(&:to_sym)
86
+ else
87
+ lambda(&:itself)
88
+ end
89
89
 
90
- # The values are not specific recognized objects.
91
- return hash.transform_values { |v| _convert_value(v, type_for_values) }
90
+ type_for_values = type.values
91
+ return hash.map { |k, v| [convert_key.call(k), _convert_value(v, type_for_values)] }.to_h
92
92
  end
93
93
 
94
94
  raise TypeError, "Could not convert hash #{hash} to `#{type}`."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optify-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Justin D. Harris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-07 00:00:00.000000000 Z
11
+ date: 2025-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime