optify-config 1.1.1-x86_64-linux → 1.2.0-x86_64-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: c1eb1ffc6d1247d02bab997feac02b34260477f8bd376a7285f88d8f390691a0
4
- data.tar.gz: 7434261c974c4542def86b56af9be981cbf38bd6ad87e6b97f9f111180447886
3
+ metadata.gz: d152a7b0a515813a7bfbffd48b0195be0ed1dbc31ceb3f8c29f58f8f5cef06c4
4
+ data.tar.gz: 8880f78d7674daf2bd61fa63db3ae50e4b35025d074d178bcc57d6147fe3851b
5
5
  SHA512:
6
- metadata.gz: 12ed18ab665cc2bf1c86132707bfa2a7f4553a2e3e17923d5499bab66c700ed22c7fdc5d25022d8549c07f540648e15a41611ed9077bd32c9a5cf94f728dc0c0
7
- data.tar.gz: 1adc408eb310c6efde2d8f30c9cbf742d4f789f6f5ced4bfb37ad0dc6c8b3b0a830878e9dd3b080ef8894e904703ae646740be9e7436131f198f6ef9aafe5e69
6
+ metadata.gz: 4f525f2ad659cfc4890225b06d6c233c83e6c7382a5376aca1d2ae8317db08700bc8e7337c2e82321373903bb0cef0e661064292ceb6b46beac0905feaa818f2
7
+ data.tar.gz: 5f23075d85e854bbb1845dee8ccb435c2d5045321486cdba8ad27ddb1f592be69db4d14d7966a9c3a168299341d025f118b78884e237b52aa55756978af4fe69
data/lib/optify.rb CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  # The implementation to use directly Ruby and with types declared.
5
5
  require_relative 'optify_ruby/implementation'
6
+ require_relative 'optify_ruby/watcher_implementation'
6
7
 
7
8
  # The implementation in Rust which redefines some methods.
8
9
  # This yields some warnings, but we should redeclare the methods in Ruby to help with type checking anyway.
Binary file
Binary file
@@ -7,6 +7,7 @@ require 'sorbet-runtime'
7
7
 
8
8
  require_relative './base_config'
9
9
  require_relative './options_metadata'
10
+ require_relative './provider_module'
10
11
 
11
12
  # Tools for working with configurations declared in files.
12
13
  module Optify
@@ -17,92 +18,26 @@ module Optify
17
18
 
18
19
  # Provides configurations based on keys and enabled feature names.
19
20
  class OptionsProvider
20
- extend T::Sig
21
+ include ProviderModule
22
+
23
+ # TODO: Find a better way to proxy the methods with copying the parameters.
21
24
 
22
25
  #: -> Hash[String, OptionsMetadata]
23
26
  def features_with_metadata
24
- return @features_with_metadata if @features_with_metadata
25
-
26
- result = JSON.parse(features_with_metadata_json)
27
- result.each do |key, value|
28
- result[key] = OptionsMetadata.from_hash(value)
29
- end
30
- result.freeze
31
-
32
- @features_with_metadata = T.let(result, T.nilable(T::Hash[String, OptionsMetadata]))
33
- result
34
- end
35
-
36
- #: (String canonical_feature_name) -> Optify::OptionsMetadata?
37
- def get_feature_metadata(canonical_feature_name)
38
- metadata_json = get_feature_metadata_json(canonical_feature_name)
39
- return nil if metadata_json.nil?
40
-
41
- OptionsMetadata.from_hash(JSON.parse(metadata_json))
27
+ _features_with_metadata
42
28
  end
43
29
 
44
- # Fetches options based on the provided key and feature names.
45
- #
46
- # @param key The key to fetch options for.
47
- # @param feature_names The enabled feature names to use to build the options.
48
- # @param config_class The class of the configuration to return.
49
- # It is recommended to use a class that extends `Optify::BaseConfig` because it implements `from_hash`.
50
- # @param cache_options Set this if caching is desired. Only very simple caching is supported for now.
51
- # @param preferences The preferences to use when getting options.
52
- # @return The options.
53
30
  #: [Config] (String key, Array[String] feature_names, Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
54
31
  def get_options(key, feature_names, config_class, cache_options = nil, preferences = nil)
55
- return get_options_with_cache(key, feature_names, config_class, cache_options, preferences) if cache_options
56
-
57
- unless config_class.respond_to?(:from_hash)
58
- raise NotImplementedError,
59
- "The provided config class must implement `from_hash` as a class method
60
- in order to be converted.
61
- Recommended: extend `Optify::BaseConfig`."
62
- end
63
-
64
- options_json = if preferences
65
- get_options_json_with_preferences(key, feature_names, preferences)
66
- else
67
- get_options_json(key, feature_names)
68
- end
69
- hash = JSON.parse(options_json)
70
- T.unsafe(config_class).from_hash(hash)
32
+ _get_options(key, feature_names, config_class, cache_options, preferences)
71
33
  end
72
34
 
73
35
  # (Optional) Eagerly initializes the cache.
74
36
  # @return [OptionsProvider] `self`.
75
37
  #: -> OptionsProvider
76
38
  def init
77
- @cache = T.let({}, T.nilable(T::Hash[T.untyped, T.untyped]))
39
+ _init
78
40
  self
79
41
  end
80
-
81
- private
82
-
83
- NOT_FOUND_IN_CACHE_SENTINEL = Object.new
84
-
85
- #: [Config] (String key, Array[String] feature_names, Class[Config] config_class, Optify::CacheOptions _cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
86
- def get_options_with_cache(key, feature_names, config_class, _cache_options, preferences = nil)
87
- # Cache directly in Ruby instead of Rust because:
88
- # * Avoid any possible conversion overhead.
89
- # * Memory management: probably better to do it in Ruby for a Ruby app and avoid memory in Rust.
90
- init unless @cache
91
- unless preferences&.skip_feature_name_conversion
92
- # When there are just a few names, then it can be faster to convert them one by one in a loop to avoid working with an array in Rust.
93
- # When there are over 7 names, then it is faster to convert them with one call to Rust.
94
- feature_names = get_canonical_feature_names(feature_names)
95
- end
96
-
97
- cache_key = [key, feature_names, config_class]
98
- result = @cache&.fetch(cache_key, NOT_FOUND_IN_CACHE_SENTINEL)
99
- return result unless result.equal?(NOT_FOUND_IN_CACHE_SENTINEL)
100
-
101
- preferences ||= GetOptionsPreferences.new
102
- preferences.skip_feature_name_conversion = true
103
- result = get_options(key, feature_names, config_class, nil, preferences)
104
-
105
- T.must(@cache)[cache_key] = result
106
- end
107
42
  end
108
43
  end
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ require 'sorbet-runtime'
5
+
6
+ module Optify
7
+ # @!visibility private
8
+ module ProviderModule
9
+ extend T::Sig
10
+
11
+ #: (Array[String] feature_names) -> Array[String]
12
+ def get_canonical_feature_names(feature_names)
13
+ # Try to optimize a typical case where there are just a few features.
14
+ # Ideally in production, a single feature that imports many other features is used for the most common scenario.
15
+ # Benchmarks show that it is faster to use a loop than to call the Rust implementation which involves making a `Vec<String>` and returning a `Vec<String>`.
16
+ if feature_names.length < 4
17
+ feature_names.map { |feature_name| get_canonical_feature_name(feature_name) }
18
+ else
19
+ _get_canonical_feature_names(feature_names)
20
+ end
21
+ end
22
+
23
+ #: (String canonical_feature_name) -> Optify::OptionsMetadata?
24
+ def get_feature_metadata(canonical_feature_name)
25
+ metadata_json = get_feature_metadata_json(canonical_feature_name)
26
+ return nil if metadata_json.nil?
27
+
28
+ OptionsMetadata.from_hash(JSON.parse(metadata_json))
29
+ end
30
+
31
+ private
32
+
33
+ #: -> Hash[String, OptionsMetadata]
34
+ def _features_with_metadata
35
+ return @features_with_metadata if @features_with_metadata
36
+
37
+ result = JSON.parse(features_with_metadata_json)
38
+ result.each do |key, value|
39
+ result[key] = OptionsMetadata.from_hash(value)
40
+ end
41
+ result.freeze
42
+
43
+ @features_with_metadata = T.let(result, T.nilable(T::Hash[String, OptionsMetadata]))
44
+ result
45
+ end
46
+
47
+ # Fetches options based on the provided key and feature names.
48
+ #
49
+ # @param key The key to fetch options for.
50
+ # @param feature_names The enabled feature names to use to build the options.
51
+ # @param config_class The class of the configuration to return.
52
+ # It is recommended to use a class that extends `Optify::BaseConfig` because it implements `from_hash`.
53
+ # @param cache_options Set this if caching is desired. Only very simple caching is supported for now.
54
+ # @param preferences The preferences to use when getting options.
55
+ # @return The options.
56
+ #: [Config] (String key, Array[String] feature_names, Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
57
+ def _get_options(key, feature_names, config_class, cache_options = nil, preferences = nil)
58
+ return get_options_with_cache(key, feature_names, config_class, cache_options, preferences) if cache_options
59
+
60
+ unless config_class.respond_to?(:from_hash)
61
+ Kernel.raise NotImplementedError,
62
+ "The provided config class must implement `from_hash` as a class method
63
+ in order to be converted.
64
+ Recommended: extend `Optify::BaseConfig`."
65
+ end
66
+
67
+ options_json = if preferences
68
+ get_options_json_with_preferences(key, feature_names, preferences)
69
+ else
70
+ get_options_json(key, feature_names)
71
+ end
72
+ hash = JSON.parse(options_json)
73
+ T.unsafe(config_class).from_hash(hash)
74
+ end
75
+
76
+ #: -> void
77
+ def _init
78
+ @cache = T.let({}, T.nilable(T::Hash[T.untyped, T.untyped]))
79
+ @features_with_metadata = T.let(nil, T.nilable(T::Hash[String, OptionsMetadata]))
80
+ end
81
+
82
+ NOT_FOUND_IN_CACHE_SENTINEL = Object.new
83
+
84
+ #: [Config] (String key, Array[String] feature_names, Class[Config] config_class, Optify::CacheOptions _cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
85
+ def get_options_with_cache(key, feature_names, config_class, _cache_options, preferences = nil)
86
+ # Cache directly in Ruby instead of Rust because:
87
+ # * Avoid any possible conversion overhead.
88
+ # * Memory management: probably better to do it in Ruby for a Ruby app and avoid memory in Rust.
89
+ init unless @cache
90
+ unless preferences&.skip_feature_name_conversion
91
+ # When there are just a few names, then it can be faster to convert them one by one in a loop to avoid working with an array in Rust.
92
+ # When there are over 7 names, then it is faster to convert them with one call to Rust.
93
+ feature_names = get_canonical_feature_names(feature_names)
94
+ end
95
+
96
+ cache_key = [key, feature_names, config_class]
97
+ result = @cache&.fetch(cache_key, NOT_FOUND_IN_CACHE_SENTINEL)
98
+ return result unless result.equal?(NOT_FOUND_IN_CACHE_SENTINEL)
99
+
100
+ preferences ||= GetOptionsPreferences.new
101
+ preferences.skip_feature_name_conversion = true
102
+ result = get_options(key, feature_names, config_class, nil, preferences)
103
+
104
+ T.must(@cache)[cache_key] = result
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ require 'json'
5
+
6
+ require 'sorbet-runtime'
7
+
8
+ require_relative './base_config'
9
+ require_relative './implementation'
10
+ require_relative './options_metadata'
11
+ require_relative './provider_module'
12
+
13
+ module Optify
14
+ # @!visibility private
15
+ class OptionsWatcher
16
+ include ProviderModule
17
+
18
+ # TODO: Find a better way to proxy the methods with copying the parameters.
19
+
20
+ #: -> Hash[String, OptionsMetadata]
21
+ def features_with_metadata
22
+ _check_cache
23
+ _features_with_metadata
24
+ end
25
+
26
+ #: [Config] (String key, Array[String] feature_names, Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
27
+ def get_options(key, feature_names, config_class, cache_options = nil, preferences = nil)
28
+ _check_cache if cache_options
29
+
30
+ _get_options(key, feature_names, config_class, cache_options, preferences)
31
+ end
32
+
33
+ # (Optional) Eagerly initializes the cache.
34
+ # @return [OptionsWatcher] `self`.
35
+ #: -> OptionsWatcher
36
+ def init
37
+ _init
38
+ @cache_creation_time = T.let(Time.now, T.nilable(Time))
39
+ self
40
+ end
41
+
42
+ private
43
+
44
+ #: -> void
45
+ def _check_cache
46
+ return if @cache_creation_time && @cache_creation_time > last_modified
47
+
48
+ # The cache is not setup or it is out of date.
49
+ init
50
+ end
51
+ end
52
+ end
data/rbi/optify.rbi CHANGED
@@ -49,8 +49,10 @@ module Optify
49
49
  def skip_feature_name_conversion; end
50
50
  end
51
51
 
52
- # Provides configurations based on keys and enabled feature names.
53
- class OptionsProvider
52
+ # A registry of features that provides configurations.
53
+ class OptionsRegistry
54
+ abstract!
55
+
54
56
  # @return All of the canonical feature names.
55
57
  sig { returns(T::Array[String]) }
56
58
  def features; end
@@ -65,7 +67,12 @@ module Optify
65
67
  .returns(String)
66
68
  end
67
69
  def get_all_options_json(feature_names, preferences); end
70
+ end
68
71
 
72
+ # A module only for internal use that provides the methods to help implement providers.
73
+ # Some of the methods shown within this module are implemented in Rust
74
+ # and are declared in this common module to avoid duplicate declarations in different classes.
75
+ module ProviderModule
69
76
  # Map an alias or canonical feature name (perhaps derived from a file name) to a canonical feature name.
70
77
  # Canonical feature names map to themselves.
71
78
  #
@@ -76,6 +83,7 @@ module Optify
76
83
 
77
84
  # Map aliases or canonical feature names (perhaps derived from a file names) to the canonical feature names.
78
85
  # Canonical feature names map to themselves.
86
+ # This implementation may do an optimization for small arrays.
79
87
  #
80
88
  # @param feature_names The names of aliases or features.
81
89
  # @return The canonical feature names.
@@ -86,28 +94,6 @@ module Optify
86
94
  sig { params(canonical_feature_name: String).returns(T.nilable(OptionsMetadata)) }
87
95
  def get_feature_metadata(canonical_feature_name); end
88
96
 
89
- # Fetches options based on the provided key and feature names.
90
- #
91
- # @param key The key to fetch options for.
92
- # @param feature_names The enabled feature names to use to build the options.
93
- # @param config_class The class of the configuration to return.
94
- # It is recommended to use a class that extends `Optify::BaseConfig` because it implements `from_hash`.
95
- # @param cache_options Set this if caching is desired. Only very simple caching is supported for now.
96
- # @param preferences The preferences to use when getting options.
97
- # @return The options.
98
- sig do
99
- type_parameters(:Config)
100
- .params(
101
- key: String,
102
- feature_names: T::Array[String],
103
- config_class: T::Class[T.type_parameter(:Config)],
104
- cache_options: T.nilable(CacheOptions),
105
- preferences: T.nilable(Optify::GetOptionsPreferences)
106
- )
107
- .returns(T.type_parameter(:Config))
108
- end
109
- def get_options(key, feature_names, config_class, cache_options = nil, preferences = nil); end
110
-
111
97
  # Fetches options in JSON format based on the provided key and feature names.
112
98
  #
113
99
  # @param key [String] the key to fetch options for.
@@ -128,13 +114,17 @@ module Optify
128
114
  end
129
115
  def get_options_json_with_preferences(key, feature_names, preferences); end
130
116
 
131
- # (Optional) Eagerly initializes the cache.
132
- # @return [OptionsProvider] `self`.
133
- sig { returns(OptionsProvider) }
134
- def init; end
135
-
136
117
  private
137
118
 
119
+ # Map aliases or canonical feature names (perhaps derived from a file names) to the canonical feature names.
120
+ # Canonical feature names map to themselves.
121
+ # This implementation calls the Rust implementation directly.
122
+ #
123
+ # @param feature_names The names of aliases or features.
124
+ # @return The canonical feature names.
125
+ sig { params(feature_names: T::Array[String]).returns(T::Array[String]) }
126
+ def _get_canonical_feature_names(feature_names); end
127
+
138
128
  # @return The metadata for the feature.
139
129
  sig { params(canonical_feature_name: String).returns(T.nilable(String)) }
140
130
  def get_feature_metadata_json(canonical_feature_name); end
@@ -142,6 +132,38 @@ module Optify
142
132
  # @return All of the keys and values for the the features.
143
133
  sig { returns(String) }
144
134
  def features_with_metadata_json; end
135
+
136
+ # Fetches options based on the provided key and feature names.
137
+ #
138
+ # @param key The key to fetch options for.
139
+ # @param feature_names The enabled feature names to use to build the options.
140
+ # @param config_class The class of the configuration to return.
141
+ # It is recommended to use a class that extends `Optify::BaseConfig` because it implements `from_hash`.
142
+ # @param cache_options Set this if caching is desired. Only very simple caching is supported for now.
143
+ # @param preferences The preferences to use when getting options.
144
+ # @return The options.
145
+ sig do
146
+ type_parameters(:Config)
147
+ .params(
148
+ key: String,
149
+ feature_names: T::Array[String],
150
+ config_class: T::Class[T.type_parameter(:Config)],
151
+ cache_options: T.nilable(CacheOptions),
152
+ preferences: T.nilable(Optify::GetOptionsPreferences)
153
+ )
154
+ .returns(T.type_parameter(:Config))
155
+ end
156
+ def get_options(key, feature_names, config_class, cache_options = nil, preferences = nil); end
157
+
158
+ # (Optional) Eagerly initializes the cache.
159
+ # @return `self`.
160
+ sig { returns(T.self_type) }
161
+ def init; end
162
+ end
163
+
164
+ # Provides configurations based on keys and enabled feature names.
165
+ class OptionsProvider < OptionsRegistry
166
+ include ProviderModule
145
167
  end
146
168
 
147
169
  # A builder for creating an `OptionsProvider` instance.
@@ -157,4 +179,30 @@ module Optify
157
179
  sig { returns(OptionsProvider) }
158
180
  def build; end
159
181
  end
182
+
183
+ # Like `OptionsProvider` but also watches for changes to the files and reloads the options.
184
+ class OptionsWatcher < OptionsRegistry
185
+ include ProviderModule
186
+
187
+ # @return [Time] Returns the time when the provider was finished building.
188
+ sig { returns(Time) }
189
+ def last_modified; end
190
+ end
191
+
192
+ # A builder for creating an `OptionsWatcher` instance.
193
+ #
194
+ # This builder is kept separate from the `OptionsProviderBuilder`
195
+ # in order to keep `OptionsProviderBuilder` and `OptionsProvider` as simple and efficient as possible for production use.
196
+ class OptionsWatcherBuilder
197
+ # Adds a directory to watch for changes.
198
+ #
199
+ # @param path [String] The path of the directory to add.
200
+ # @return [OptionsWatcherBuilder] `self`.
201
+ sig { params(path: String).returns(OptionsWatcherBuilder) }
202
+ def add_directory(path); end
203
+
204
+ # @return [OptionsWatcher] A newly built `OptionsWatcher`.
205
+ sig { returns(OptionsWatcher) }
206
+ def build; end
207
+ end
160
208
  end
data/sig/optify.rbs CHANGED
@@ -40,8 +40,8 @@ class Optify::GetOptionsPreferences
40
40
  def skip_feature_name_conversion: () -> bool
41
41
  end
42
42
 
43
- # Provides configurations based on keys and enabled feature names.
44
- class Optify::OptionsProvider
43
+ # A registry of features that provides configurations.
44
+ class Optify::OptionsRegistry
45
45
  # @return All of the canonical feature names.
46
46
  def features: () -> ::Array[String]
47
47
 
@@ -49,7 +49,12 @@ class Optify::OptionsProvider
49
49
  def features_with_metadata: () -> ::Hash[String, OptionsMetadata]
50
50
 
51
51
  def get_all_options_json: (::Array[String] feature_names, GetOptionsPreferences preferences) -> String
52
+ end
52
53
 
54
+ # A module only for internal use that provides the methods to help implement providers.
55
+ # Some of the methods shown within this module are implemented in Rust
56
+ # and are declared in this common module to avoid duplicate declarations in different classes.
57
+ module Optify::ProviderModule
53
58
  # Map an alias or canonical feature name (perhaps derived from a file name) to a canonical feature name.
54
59
  # Canonical feature names map to themselves.
55
60
  #
@@ -59,6 +64,7 @@ class Optify::OptionsProvider
59
64
 
60
65
  # Map aliases or canonical feature names (perhaps derived from a file names) to the canonical feature names.
61
66
  # Canonical feature names map to themselves.
67
+ # This implementation may do an optimization for small arrays.
62
68
  #
63
69
  # @param feature_names The names of aliases or features.
64
70
  # @return The canonical feature names.
@@ -67,8 +73,6 @@ class Optify::OptionsProvider
67
73
  # @return The metadata for the feature.
68
74
  def get_feature_metadata: (String canonical_feature_name) -> OptionsMetadata?
69
75
 
70
- def get_options: [Config] (String key, ::Array[String] feature_names, T::Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
71
-
72
76
  # Fetches options in JSON format based on the provided key and feature names.
73
77
  #
74
78
  # @param key [String] the key to fetch options for.
@@ -78,15 +82,30 @@ class Optify::OptionsProvider
78
82
 
79
83
  def get_options_json_with_preferences: (String key, ::Array[String] feature_names, GetOptionsPreferences preferences) -> String
80
84
 
81
- # (Optional) Eagerly initializes the cache.
82
- # @return [OptionsProvider] `self`.
83
- def init: () -> OptionsProvider
85
+ # Map aliases or canonical feature names (perhaps derived from a file names) to the canonical feature names.
86
+ # Canonical feature names map to themselves.
87
+ # This implementation calls the Rust implementation directly.
88
+ #
89
+ # @param feature_names The names of aliases or features.
90
+ # @return The canonical feature names.
91
+ def _get_canonical_feature_names: (::Array[String] feature_names) -> ::Array[String]
84
92
 
85
93
  # @return The metadata for the feature.
86
94
  def get_feature_metadata_json: (String canonical_feature_name) -> String?
87
95
 
88
96
  # @return All of the keys and values for the the features.
89
97
  def features_with_metadata_json: () -> String
98
+
99
+ def get_options: [Config] (String key, ::Array[String] feature_names, T::Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
100
+
101
+ # (Optional) Eagerly initializes the cache.
102
+ # @return `self`.
103
+ def init: () -> self
104
+ end
105
+
106
+ # Provides configurations based on keys and enabled feature names.
107
+ class Optify::OptionsProvider < OptionsRegistry
108
+ include ProviderModule
90
109
  end
91
110
 
92
111
  # A builder for creating an `OptionsProvider` instance.
@@ -100,3 +119,26 @@ class Optify::OptionsProviderBuilder
100
119
  # @return [OptionsProvider] A newly built `OptionsProvider`.
101
120
  def build: () -> OptionsProvider
102
121
  end
122
+
123
+ # Like `OptionsProvider` but also watches for changes to the files and reloads the options.
124
+ class Optify::OptionsWatcher < OptionsRegistry
125
+ include ProviderModule
126
+
127
+ # @return [Time] Returns the time when the provider was finished building.
128
+ def last_modified: () -> Time
129
+ end
130
+
131
+ # A builder for creating an `OptionsWatcher` instance.
132
+ #
133
+ # This builder is kept separate from the `OptionsProviderBuilder`
134
+ # in order to keep `OptionsProviderBuilder` and `OptionsProvider` as simple and efficient as possible for production use.
135
+ class Optify::OptionsWatcherBuilder
136
+ # Adds a directory to watch for changes.
137
+ #
138
+ # @param path [String] The path of the directory to add.
139
+ # @return [OptionsWatcherBuilder] `self`.
140
+ def add_directory: (String path) -> OptionsWatcherBuilder
141
+
142
+ # @return [OptionsWatcher] A newly built `OptionsWatcher`.
143
+ def build: () -> OptionsWatcher
144
+ end
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.1.1
4
+ version: 1.2.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Justin D. Harris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-11 00:00:00.000000000 Z
11
+ date: 2025-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -108,6 +108,8 @@ files:
108
108
  - lib/optify_ruby/base_config.rb
109
109
  - lib/optify_ruby/implementation.rb
110
110
  - lib/optify_ruby/options_metadata.rb
111
+ - lib/optify_ruby/provider_module.rb
112
+ - lib/optify_ruby/watcher_implementation.rb
111
113
  - rbi/optify.rbi
112
114
  - sig/optify.rbs
113
115
  homepage: https://github.com/juharris/optify