optify-config 1.17.6-arm64-darwin → 1.17.8-arm64-darwin

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: 7194e6690705605acf61b48ed9d55db4cef55c29120bab6552fb39dcb4ec9f27
4
- data.tar.gz: 26d5d0bd5f1e750368cb44c3404735481834699a5fa03071420116b345a68c64
3
+ metadata.gz: 4791dc183294ae4bdbd632abe7279d329c5acb2574cbfd331000c13b10e11b3a
4
+ data.tar.gz: 911dd721fe1ca6abe1ae9edbb633a034d6a2512604926882c92d8c0b8aaa5159
5
5
  SHA512:
6
- metadata.gz: b8302c2b9f69e3d2c4550f50f9debbfa65faf0cfe0abdf9145a2c08e894d2ae5080663ad51f8900e0d1717bfe4068bd462aedf0c906e83ee32c4ca83941fa07b
7
- data.tar.gz: dd3e538a9d65c1546ccf197ca3003c8d4aa078d7175bae8573d450fa708db0f62e5c760aa9a3459a68b56972a112c2eb0ae292593df1d0fd057278d073f1fb0e
6
+ metadata.gz: 67faf32691399abeb9d2914b37aabf4513beeceeee6d4b7d825676452b184f2a85dde4a28bedef5fae7142f144f569d8a387a9aadc8951f893bd94389d65aad0
7
+ data.tar.gz: 711215755ac6939e2babb0f963bac46587a4ea8214b57ed5547a1224487852d3e66d31b56355843b713c7171dd63ac842a0c9b244a376885598680b021977f0c
data/lib/optify.rb CHANGED
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # typed: strict
2
+ # frozen_string_literal: true
3
3
 
4
4
  # The implementation to use directly Ruby and with types declared.
5
5
  require_relative 'optify_ruby/get_options_preferences'
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # typed: strict
2
+ # frozen_string_literal: true
3
3
 
4
4
  module Optify
5
5
  # Preferences for `get_options`.
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # typed: strict
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'sorbet-runtime'
5
5
 
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # typed: true
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'sorbet-runtime'
5
5
 
@@ -1,6 +1,7 @@
1
- # frozen_string_literal: true
2
1
  # typed: strict
2
+ # frozen_string_literal: true
3
3
 
4
+ require 'json'
4
5
  require 'sorbet-runtime'
5
6
 
6
7
  module Optify
@@ -52,7 +53,7 @@ module Optify
52
53
  # @param cache_options Set this if caching is desired. Only very simple caching is supported for now.
53
54
  # @param preferences The preferences to use when getting options.
54
55
  # @return The options.
55
- #: [Config] (String key, Array[String] feature_names, Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
56
+ #: [Config] (String, Array[String], Class[Config], ?CacheOptions?, ?Optify::GetOptionsPreferences?) -> Config
56
57
  def _get_options(key, feature_names, config_class, cache_options = nil, preferences = nil)
57
58
  return get_options_with_cache(key, feature_names, config_class, cache_options, preferences) if cache_options
58
59
 
@@ -63,12 +64,11 @@ module Optify
63
64
  Recommended: extend `Optify::FromHashable`."
64
65
  end
65
66
 
66
- options_json = if preferences
67
- get_options_json_with_preferences(key, feature_names, preferences)
68
- else
69
- get_options_json(key, feature_names)
70
- end
71
- hash = JSON.parse(options_json)
67
+ hash = if preferences
68
+ get_options_hash_with_preferences(key, feature_names, preferences)
69
+ else
70
+ get_options_hash(key, feature_names)
71
+ end
72
72
  config_class #: as untyped
73
73
  .from_hash(hash)
74
74
  end
@@ -79,8 +79,6 @@ module Optify
79
79
  @features_with_metadata = nil #: Hash[String, OptionsMetadata]?
80
80
  end
81
81
 
82
- NOT_FOUND_IN_CACHE_SENTINEL = Object.new
83
-
84
82
  #: [Config] (String key, Array[String] feature_names, Class[Config] config_class, Optify::CacheOptions _cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
85
83
  def get_options_with_cache(key, feature_names, config_class, _cache_options, preferences = nil)
86
84
  # Cache directly in Ruby instead of Rust because:
@@ -102,23 +100,22 @@ module Optify
102
100
  # Features are filtered, so we don't need the constraints in the cache key.
103
101
  are_configurable_strings_enabled = preferences&.are_configurable_strings_enabled? || false
104
102
  cache_key = [key, feature_names, are_configurable_strings_enabled, config_class]
105
- result = @cache #: as !nil
106
- .fetch(cache_key, NOT_FOUND_IN_CACHE_SENTINEL)
107
- return result unless result.equal?(NOT_FOUND_IN_CACHE_SENTINEL)
108
-
109
- # Handle a cache miss.
103
+ @cache #: as !nil
104
+ .fetch(cache_key) do
105
+ # Handle a cache miss.
110
106
 
111
- # We can avoid converting the features names because they're already converted from filtering above, if that was desired.
112
- # We don't need the constraints because we filtered the features above.
113
- # We already know there are no overrides because we checked above.
114
- preferences = GetOptionsPreferences.new
115
- preferences.skip_feature_name_conversion = true
116
- preferences.enable_configurable_strings if are_configurable_strings_enabled
107
+ # We can avoid converting the features names because they're already converted from filtering above, if that was desired.
108
+ # We don't need the constraints because we filtered the features above.
109
+ # We already know there are no overrides because we checked above.
110
+ preferences = GetOptionsPreferences.new
111
+ preferences.skip_feature_name_conversion = true
112
+ preferences.enable_configurable_strings if are_configurable_strings_enabled
117
113
 
118
- result = get_options(key, feature_names, config_class, nil, preferences)
114
+ result = get_options(key, feature_names, config_class, nil, preferences)
119
115
 
120
- @cache #: as !nil
121
- .[]= cache_key, result
116
+ @cache #: as !nil
117
+ .[]= cache_key, result
118
+ end
122
119
  end
123
120
  end
124
121
  end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # typed: strict
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'sorbet-runtime'
5
5
 
data/rbi/optify.rbi CHANGED
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # typed: strong
2
+ # frozen_string_literal: true
3
3
 
4
4
  # Tools for working with configurations declared in files.
5
5
  module Optify
@@ -142,6 +142,13 @@ module Optify
142
142
  sig { returns(T::Hash[String, OptionsMetadata]) }
143
143
  def features_with_metadata; end
144
144
 
145
+ # @return All of the keys and values for the the features.
146
+ sig do
147
+ params(feature_names: T::Array[String], preferences: GetOptionsPreferences)
148
+ .returns(T::Hash[String, T.untyped])
149
+ end
150
+ def get_all_options_hash(feature_names, preferences); end
151
+
145
152
  # @return All of the keys and values for the the features.
146
153
  sig do
147
154
  params(feature_names: T::Array[String], preferences: GetOptionsPreferences)
@@ -210,6 +217,26 @@ module Optify
210
217
  end
211
218
  def get_options(key, feature_names, config_class, cache_options = nil, preferences = nil); end
212
219
 
220
+ # Fetches options based on the provided key and feature names.
221
+ #
222
+ # @param key [String] the key to fetch options for.
223
+ # @param feature_names [Array<String>] The enabled feature names to use to build the options.
224
+ # @return [Hash[String, T.untyped]] the options.
225
+ sig { params(key: String, feature_names: T::Array[String]).returns(T::Hash[String, T.untyped]) }
226
+ def get_options_hash(key, feature_names); end
227
+
228
+ # Fetches options based on the provided key and feature names.
229
+ #
230
+ # @param key [String] the key to fetch options for.
231
+ # @param feature_names [Array<String>] The enabled feature names to use to build the options.
232
+ # @param preferences [GetOptionsPreferences] The preferences to use when getting options.
233
+ # @return [String] the options in JSON.
234
+ sig do
235
+ params(key: String, feature_names: T::Array[String], preferences: GetOptionsPreferences)
236
+ .returns(T::Hash[String, T.untyped])
237
+ end
238
+ def get_options_hash_with_preferences(key, feature_names, preferences); end
239
+
213
240
  # Fetches options in JSON format based on the provided key and feature names.
214
241
  #
215
242
  # @param key [String] the key to fetch options for.
data/sig/optify.rbs CHANGED
@@ -110,6 +110,8 @@ class Optify::OptionsRegistry
110
110
  # @return All of the keys and values for the the features.
111
111
  def features_with_metadata: () -> ::Hash[String, OptionsMetadata]
112
112
 
113
+ def get_all_options_hash: (::Array[String] feature_names, GetOptionsPreferences preferences) -> ::Hash[String, untyped]
114
+
113
115
  def get_all_options_json: (::Array[String] feature_names, GetOptionsPreferences preferences) -> String
114
116
  end
115
117
 
@@ -139,6 +141,15 @@ module Optify::ProviderModule
139
141
 
140
142
  def get_options: [Config] (String key, ::Array[String] feature_names, T::Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
141
143
 
144
+ # Fetches options based on the provided key and feature names.
145
+ #
146
+ # @param key [String] the key to fetch options for.
147
+ # @param feature_names [Array<String>] The enabled feature names to use to build the options.
148
+ # @return [Hash[String, T.untyped]] the options.
149
+ def get_options_hash: (String key, ::Array[String] feature_names) -> ::Hash[String, untyped]
150
+
151
+ def get_options_hash_with_preferences: (String key, ::Array[String] feature_names, GetOptionsPreferences preferences) -> ::Hash[String, untyped]
152
+
142
153
  # Fetches options in JSON format based on the provided key and feature names.
143
154
  #
144
155
  # @param key [String] the key to fetch options for.
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optify-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.6
4
+ version: 1.17.8
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Justin D. Harris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-11-10 00:00:00.000000000 Z
11
+ date: 2025-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: optify-from_hash
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: sorbet-runtime
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,6 +72,34 @@ dependencies:
58
72
  - - "~>"
59
73
  - !ruby/object:Gem::Version
60
74
  version: 4.0.0.dev.4
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 1.76.1
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 1.76.1
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop-sorbet
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 0.11.0
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 0.11.0
61
103
  - !ruby/object:Gem::Dependency
62
104
  name: sorbet
63
105
  requirement: !ruby/object:Gem::Requirement