optify-config 1.5.0 → 1.6.0
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/ext/optify_ruby/Cargo.toml +2 -2
- data/ext/optify_ruby/src/lib.rs +49 -21
- data/rbi/optify.rbi +8 -0
- data/sig/optify.rbs +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36866b3812d07006be63012e27381c3cae692e3a4a4adc6c1c9d54dbfda32c26
|
4
|
+
data.tar.gz: df8fa299cbd2bc4891011e60a847c1819ab83de05b668924576515ffab648773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57eec9c48450af7a1b0541d2e241215f4b5b7c374d0b8e5a39dcfee1608cab60f29f02483c9b7a8a4422bb70cbde863c659c5e7f01821e21f06bcb1cb7005cb3
|
7
|
+
data.tar.gz: c8bec708ad806a205a3fe0d9dee33237e1c29b38c4c42ad8df21daf1d7c9910322e7b99abddeba512a3175b8b368b42db1e564be148e2731f078aec6e17e42fb
|
data/ext/optify_ruby/Cargo.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "optify_ruby"
|
3
|
-
version = "0.
|
3
|
+
version = "0.10.0"
|
4
4
|
edition = "2021"
|
5
5
|
|
6
6
|
description = "optify bindings for Ruby"
|
@@ -21,6 +21,6 @@ crate-type = ["cdylib"]
|
|
21
21
|
|
22
22
|
[dependencies]
|
23
23
|
magnus = "0.7.1"
|
24
|
-
optify = { path = "../../../../rust/optify", version = "0.
|
24
|
+
optify = { path = "../../../../rust/optify", version = "0.10.0" }
|
25
25
|
rb-sys = { version = "*", default-features = false, features = ["ruby-static"] }
|
26
26
|
serde_json = "1.0.140"
|
data/ext/optify_ruby/src/lib.rs
CHANGED
@@ -53,6 +53,14 @@ fn convert_metadata(metadata: &OptionsMetadata) -> String {
|
|
53
53
|
}
|
54
54
|
|
55
55
|
impl WrappedOptionsProvider {
|
56
|
+
fn get_aliases(&self) -> Vec<String> {
|
57
|
+
self.0.borrow().get_aliases()
|
58
|
+
}
|
59
|
+
|
60
|
+
fn get_features_and_aliases(&self) -> Vec<String> {
|
61
|
+
self.0.borrow().get_features_and_aliases()
|
62
|
+
}
|
63
|
+
|
56
64
|
// These methods cannot accept `str`s because of how magnus works.
|
57
65
|
// Return the JSON as a string so that it can be deserialized easily into a specific immutable class in Ruby.
|
58
66
|
fn get_all_options_json(
|
@@ -61,12 +69,12 @@ impl WrappedOptionsProvider {
|
|
61
69
|
feature_names: Vec<String>,
|
62
70
|
preferences: &MutGetOptionsPreferences,
|
63
71
|
) -> Result<String, magnus::Error> {
|
64
|
-
let
|
72
|
+
let preferences = convert_preferences(preferences);
|
65
73
|
let features = convert_to_str_slice!(feature_names);
|
66
74
|
match rb_self
|
67
75
|
.0
|
68
76
|
.borrow()
|
69
|
-
.get_all_options(&features,
|
77
|
+
.get_all_options(&features, None, Some(&preferences))
|
70
78
|
{
|
71
79
|
Ok(options) => Ok(options.to_string()),
|
72
80
|
Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
|
@@ -125,7 +133,7 @@ impl WrappedOptionsProvider {
|
|
125
133
|
match rb_self
|
126
134
|
.0
|
127
135
|
.borrow()
|
128
|
-
.get_options_with_preferences(&key, &features,
|
136
|
+
.get_options_with_preferences(&key, &features, None, None)
|
129
137
|
{
|
130
138
|
Ok(options) => Ok(options.to_string()),
|
131
139
|
Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
|
@@ -139,24 +147,25 @@ impl WrappedOptionsProvider {
|
|
139
147
|
feature_names: Vec<String>,
|
140
148
|
preferences: &MutGetOptionsPreferences,
|
141
149
|
) -> Result<String, magnus::Error> {
|
142
|
-
let
|
150
|
+
let preferences = convert_preferences(preferences);
|
143
151
|
let features = convert_to_str_slice!(feature_names);
|
144
|
-
match rb_self
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
152
|
+
match rb_self.0.borrow().get_options_with_preferences(
|
153
|
+
&key,
|
154
|
+
&features,
|
155
|
+
None,
|
156
|
+
Some(&preferences),
|
157
|
+
) {
|
149
158
|
Ok(options) => Ok(options.to_string()),
|
150
159
|
Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
|
151
160
|
}
|
152
161
|
}
|
153
162
|
}
|
154
163
|
|
155
|
-
fn convert_preferences(preferences: &MutGetOptionsPreferences) ->
|
156
|
-
|
164
|
+
fn convert_preferences(preferences: &MutGetOptionsPreferences) -> GetOptionsPreferences {
|
165
|
+
GetOptionsPreferences {
|
157
166
|
overrides_json: preferences.get_overrides_json(),
|
158
167
|
skip_feature_name_conversion: preferences.skip_feature_name_conversion(),
|
159
|
-
}
|
168
|
+
}
|
160
169
|
}
|
161
170
|
|
162
171
|
#[derive(Clone)]
|
@@ -192,18 +201,26 @@ impl WrappedOptionsProviderBuilder {
|
|
192
201
|
struct WrappedOptionsWatcher(RefCell<OptionsWatcher>);
|
193
202
|
|
194
203
|
impl WrappedOptionsWatcher {
|
204
|
+
fn get_aliases(&self) -> Vec<String> {
|
205
|
+
self.0.borrow().get_aliases()
|
206
|
+
}
|
207
|
+
|
208
|
+
fn get_features_and_aliases(&self) -> Vec<String> {
|
209
|
+
self.0.borrow().get_features_and_aliases()
|
210
|
+
}
|
211
|
+
|
195
212
|
fn get_all_options_json(
|
196
213
|
ruby: &Ruby,
|
197
214
|
rb_self: &Self,
|
198
215
|
feature_names: Vec<String>,
|
199
216
|
preferences: &MutGetOptionsPreferences,
|
200
217
|
) -> Result<String, magnus::Error> {
|
201
|
-
let
|
218
|
+
let preferences = convert_preferences(preferences);
|
202
219
|
let features = convert_to_str_slice!(feature_names);
|
203
220
|
match rb_self
|
204
221
|
.0
|
205
222
|
.borrow()
|
206
|
-
.get_all_options(&features,
|
223
|
+
.get_all_options(&features, None, Some(&preferences))
|
207
224
|
{
|
208
225
|
Ok(options) => Ok(options.to_string()),
|
209
226
|
Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
|
@@ -260,7 +277,7 @@ impl WrappedOptionsWatcher {
|
|
260
277
|
match rb_self
|
261
278
|
.0
|
262
279
|
.borrow()
|
263
|
-
.get_options_with_preferences(&key, &features,
|
280
|
+
.get_options_with_preferences(&key, &features, None, None)
|
264
281
|
{
|
265
282
|
Ok(options) => Ok(options.to_string()),
|
266
283
|
Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
|
@@ -274,13 +291,14 @@ impl WrappedOptionsWatcher {
|
|
274
291
|
feature_names: Vec<String>,
|
275
292
|
preferences: &MutGetOptionsPreferences,
|
276
293
|
) -> Result<String, magnus::Error> {
|
277
|
-
let
|
294
|
+
let preferences = convert_preferences(preferences);
|
278
295
|
let features = convert_to_str_slice!(feature_names);
|
279
|
-
match rb_self
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
296
|
+
match rb_self.0.borrow().get_options_with_preferences(
|
297
|
+
&key,
|
298
|
+
&features,
|
299
|
+
None,
|
300
|
+
Some(&preferences),
|
301
|
+
) {
|
284
302
|
Ok(options) => Ok(options.to_string()),
|
285
303
|
Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
|
286
304
|
}
|
@@ -335,7 +353,12 @@ fn init(ruby: &Ruby) -> Result<(), magnus::Error> {
|
|
335
353
|
builder_class.define_method("build", method!(WrappedOptionsProviderBuilder::build, 0))?;
|
336
354
|
|
337
355
|
let provider_class = module.define_class("OptionsProvider", ruby.class_object())?;
|
356
|
+
provider_class.define_method("aliases", method!(WrappedOptionsProvider::get_aliases, 0))?;
|
338
357
|
provider_class.define_method("features", method!(WrappedOptionsProvider::get_features, 0))?;
|
358
|
+
provider_class.define_method(
|
359
|
+
"features_and_aliases",
|
360
|
+
method!(WrappedOptionsProvider::get_features_and_aliases, 0),
|
361
|
+
)?;
|
339
362
|
provider_class.define_method(
|
340
363
|
"get_all_options_json",
|
341
364
|
method!(WrappedOptionsProvider::get_all_options_json, 2),
|
@@ -405,7 +428,12 @@ fn init(ruby: &Ruby) -> Result<(), magnus::Error> {
|
|
405
428
|
.define_method("build", method!(WrappedOptionsWatcherBuilder::build, 0))?;
|
406
429
|
|
407
430
|
let watcher_class = module.define_class("OptionsWatcher", ruby.class_object())?;
|
431
|
+
watcher_class.define_method("aliases", method!(WrappedOptionsWatcher::get_aliases, 0))?;
|
408
432
|
watcher_class.define_method("features", method!(WrappedOptionsWatcher::get_features, 0))?;
|
433
|
+
watcher_class.define_method(
|
434
|
+
"features_and_aliases",
|
435
|
+
method!(WrappedOptionsWatcher::get_features_and_aliases, 0),
|
436
|
+
)?;
|
409
437
|
watcher_class.define_method(
|
410
438
|
"get_all_options_json",
|
411
439
|
method!(WrappedOptionsWatcher::get_all_options_json, 2),
|
data/rbi/optify.rbi
CHANGED
@@ -76,6 +76,14 @@ module Optify
|
|
76
76
|
class OptionsRegistry
|
77
77
|
abstract!
|
78
78
|
|
79
|
+
# @return All of the aliases.
|
80
|
+
sig { returns(T::Array[String]) }
|
81
|
+
def aliases; end
|
82
|
+
|
83
|
+
# @return All of the aliases and features.
|
84
|
+
sig { returns(T::Array[String]) }
|
85
|
+
def features_and_aliases; end
|
86
|
+
|
79
87
|
# @return All of the canonical feature names.
|
80
88
|
sig { returns(T::Array[String]) }
|
81
89
|
def features; end
|
data/sig/optify.rbs
CHANGED
@@ -60,6 +60,12 @@ end
|
|
60
60
|
|
61
61
|
# A registry of features that provides configurations.
|
62
62
|
class Optify::OptionsRegistry
|
63
|
+
# @return All of the aliases.
|
64
|
+
def aliases: () -> ::Array[String]
|
65
|
+
|
66
|
+
# @return All of the aliases and features.
|
67
|
+
def features_and_aliases: () -> ::Array[String]
|
68
|
+
|
63
69
|
# @return All of the canonical feature names.
|
64
70
|
def features: () -> ::Array[String]
|
65
71
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optify-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin D. Harris
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-06-11 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rb_sys
|