optify-config 0.6.0-x86_64-linux → 0.6.1-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 +4 -4
- data/lib/optify_ruby/3.1/optify_ruby.so +0 -0
- data/lib/optify_ruby/3.2/optify_ruby.so +0 -0
- data/lib/optify_ruby/3.4/optify_ruby.so +0 -0
- data/lib/optify_ruby/base_config.rb +4 -9
- data/lib/optify_ruby/implementation.rb +9 -29
- data/rbi/optify.rbi +7 -7
- data/sig/optify.rbs +67 -0
- metadata +23 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b6b92f653278035c649822630c249c8c250640b765219d1568a3cd046570055
|
4
|
+
data.tar.gz: b1b58e7557f9af9961f71939116967c4e4e2c192b8f2dc4d2ae044207673bf34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23ea56dea463d0d77783604005e68f438392904e215849d07aaa9e17665e6b97921bb22578ae35199cbaa2ff14fd7e41e96bb0919e316285e2e4d6b59905b005
|
7
|
+
data.tar.gz: 8ef1de56881966cf126bf265d8b3c19845661a4e37244e3356fcb03ad37809c72d083543984f90a3b217bd0a76bc99a681dd5f25b59f04e0c01ca6db0c439ef3
|
Binary file
|
Binary file
|
Binary file
|
@@ -19,9 +19,9 @@ module Optify
|
|
19
19
|
# Create a new immutable instance of the class from a hash.
|
20
20
|
#
|
21
21
|
# This is a class method that so that it can set members with private setters.
|
22
|
-
# @param hash
|
22
|
+
# @param hash The hash to create the instance from.
|
23
23
|
# @return The new instance.
|
24
|
-
|
24
|
+
#: (Hash[untyped, untyped] hash) -> instance
|
25
25
|
def self.from_hash(hash)
|
26
26
|
result = new
|
27
27
|
|
@@ -34,7 +34,7 @@ module Optify
|
|
34
34
|
T.unsafe(result).freeze if T.unsafe(result).respond_to?(:freeze)
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
#: (untyped value, untyped type) -> untyped
|
38
38
|
def self._convert_value(value, type)
|
39
39
|
case value
|
40
40
|
when Array
|
@@ -55,12 +55,7 @@ module Optify
|
|
55
55
|
value
|
56
56
|
end
|
57
57
|
|
58
|
-
|
59
|
-
params(
|
60
|
-
hash: T::Hash[T.untyped, T.untyped],
|
61
|
-
type: T.untyped
|
62
|
-
).returns(T.untyped)
|
63
|
-
end
|
58
|
+
#: (Hash[untyped, untyped] hash, untyped type) -> untyped
|
64
59
|
def self._convert_hash(hash, type) # rubocop:disable Metrics/PerceivedComplexity
|
65
60
|
if type.respond_to?(:raw_type)
|
66
61
|
# There is an object for the hash.
|
@@ -20,24 +20,14 @@ module Optify
|
|
20
20
|
|
21
21
|
# Fetches options based on the provided key and feature names.
|
22
22
|
#
|
23
|
-
# @param key
|
24
|
-
# @param feature_names
|
25
|
-
# @param config_class
|
23
|
+
# @param key The key to fetch options for.
|
24
|
+
# @param feature_names The enabled feature names to use to build the options.
|
25
|
+
# @param config_class The class of the configuration to return.
|
26
26
|
# It is recommended to use a class that extends `Optify::BaseConfig` because it implements `from_hash`.
|
27
|
-
# @param cache_options
|
28
|
-
# @param preferences
|
29
|
-
# @return
|
30
|
-
|
31
|
-
type_parameters(:Config)
|
32
|
-
.params(
|
33
|
-
key: String,
|
34
|
-
feature_names: T::Array[String],
|
35
|
-
config_class: T::Class[T.type_parameter(:Config)],
|
36
|
-
cache_options: T.nilable(CacheOptions),
|
37
|
-
preferences: T.nilable(Optify::GetOptionsPreferences)
|
38
|
-
)
|
39
|
-
.returns(T.type_parameter(:Config))
|
40
|
-
end
|
27
|
+
# @param cache_options Set this if caching is desired. Only very simple caching is supported for now.
|
28
|
+
# @param preferences The preferences to use when getting options.
|
29
|
+
# @return The options.
|
30
|
+
#: [Config] (String key, Array[String] feature_names, Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
|
41
31
|
def get_options(key, feature_names, config_class, cache_options = nil, preferences = nil)
|
42
32
|
return get_options_with_cache(key, feature_names, config_class, cache_options, preferences) if cache_options
|
43
33
|
|
@@ -59,7 +49,7 @@ module Optify
|
|
59
49
|
|
60
50
|
# (Optional) Eagerly initializes the cache.
|
61
51
|
# @return [OptionsProvider] `self`.
|
62
|
-
|
52
|
+
#: -> OptionsProvider
|
63
53
|
def init
|
64
54
|
@cache = T.let({}, T.nilable(T::Hash[T.untyped, T.untyped]))
|
65
55
|
self
|
@@ -69,17 +59,7 @@ module Optify
|
|
69
59
|
|
70
60
|
NOT_FOUND_IN_CACHE_SENTINEL = Object.new
|
71
61
|
|
72
|
-
|
73
|
-
type_parameters(:Config)
|
74
|
-
.params(
|
75
|
-
key: String,
|
76
|
-
feature_names: T::Array[String],
|
77
|
-
config_class: T::Class[T.type_parameter(:Config)],
|
78
|
-
_cache_options: CacheOptions,
|
79
|
-
preferences: T.nilable(Optify::GetOptionsPreferences)
|
80
|
-
)
|
81
|
-
.returns(T.type_parameter(:Config))
|
82
|
-
end
|
62
|
+
#: [Config] (String key, Array[String] feature_names, Class[Config] config_class, Optify::CacheOptions _cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
|
83
63
|
def get_options_with_cache(key, feature_names, config_class, _cache_options, preferences = nil)
|
84
64
|
# Cache directly in Ruby instead of Rust because:
|
85
65
|
# * Avoid any possible conversion overhead.
|
data/rbi/optify.rbi
CHANGED
@@ -15,7 +15,7 @@ module Optify
|
|
15
15
|
# Create a new instance of the class from a hash.
|
16
16
|
#
|
17
17
|
# This is a class method that so that it can set members with private setters.
|
18
|
-
# @param hash
|
18
|
+
# @param hash The hash to create the instance from.
|
19
19
|
# @return The new instance.
|
20
20
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
21
21
|
def self.from_hash(hash); end
|
@@ -46,13 +46,13 @@ module Optify
|
|
46
46
|
|
47
47
|
# Fetches options based on the provided key and feature names.
|
48
48
|
#
|
49
|
-
# @param key
|
50
|
-
# @param feature_names
|
51
|
-
# @param config_class
|
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
52
|
# It is recommended to use a class that extends `Optify::BaseConfig` because it implements `from_hash`.
|
53
|
-
# @param cache_options
|
54
|
-
# @param preferences
|
55
|
-
# @return
|
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
56
|
sig do
|
57
57
|
type_parameters(:Config)
|
58
58
|
.params(
|
data/sig/optify.rbs
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Tools for working with configurations declared in files.
|
2
|
+
module Optify
|
3
|
+
end
|
4
|
+
|
5
|
+
# A base class for classes from configuration files.
|
6
|
+
# Classes that derive from this can easily be used with `Optify::OptionsProvider.get_options`
|
7
|
+
# because they will have an implementation of `from_hash` that works recursively.
|
8
|
+
# This class is a work in progress with minimal error handling
|
9
|
+
# and doesn't handle certain cases such as nilable types yet.
|
10
|
+
# It may be moved to another gem in the future.
|
11
|
+
class Optify::BaseConfig
|
12
|
+
# Create a new instance of the class from a hash.
|
13
|
+
#
|
14
|
+
# This is a class method that so that it can set members with private setters.
|
15
|
+
# @param hash The hash to create the instance from.
|
16
|
+
# @return The new instance.
|
17
|
+
def self.from_hash: (::Hash[untyped, untyped] hash) -> instance
|
18
|
+
end
|
19
|
+
|
20
|
+
# Options for caching.
|
21
|
+
# Only enabling or disabling caching is supported for now.
|
22
|
+
class Optify::CacheOptions < BaseConfig
|
23
|
+
end
|
24
|
+
|
25
|
+
# Preferences when getting options.
|
26
|
+
class Optify::GetOptionsPreferences
|
27
|
+
def skip_feature_name_conversion=: (bool value) -> GetOptionsPreferences
|
28
|
+
|
29
|
+
def skip_feature_name_conversion: () -> bool
|
30
|
+
end
|
31
|
+
|
32
|
+
# Provides configurations based on keys and enabled feature names.
|
33
|
+
class Optify::OptionsProvider
|
34
|
+
# Map an alias or canonical feature name (perhaps derived from a file name) to a canonical feature name.
|
35
|
+
# Canonical feature names map to themselves.
|
36
|
+
#
|
37
|
+
# @param feature_name The name of an alias or a feature.
|
38
|
+
# @return The canonical feature name.
|
39
|
+
def get_canonical_feature_name: (String feature_name) -> String
|
40
|
+
|
41
|
+
def get_options: [Config] (String key, ::Array[String] feature_names, T::Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
|
42
|
+
|
43
|
+
# Fetches options in JSON format based on the provided key and feature names.
|
44
|
+
#
|
45
|
+
# @param key [String] the key to fetch options for.
|
46
|
+
# @param feature_names [Array<String>] The enabled feature names to use to build the options.
|
47
|
+
# @return [String] the options in JSON.
|
48
|
+
def get_options_json: (String key, ::Array[String] feature_names) -> String
|
49
|
+
|
50
|
+
def get_options_json_with_preferences: (String key, ::Array[String] feature_names, GetOptionsPreferences preferences) -> String
|
51
|
+
|
52
|
+
# (Optional) Eagerly initializes the cache.
|
53
|
+
# @return [OptionsProvider] `self`.
|
54
|
+
def init: () -> OptionsProvider
|
55
|
+
end
|
56
|
+
|
57
|
+
# A builder for creating an `OptionsProvider` instance.
|
58
|
+
class Optify::OptionsProviderBuilder
|
59
|
+
# Adds a directory to the builder.
|
60
|
+
#
|
61
|
+
# @param path [String] The path of the directory to add.
|
62
|
+
# @return [OptionsProviderBuilder] `self`.
|
63
|
+
def add_directory: (String path) -> OptionsProviderBuilder
|
64
|
+
|
65
|
+
# @return [OptionsProvider] A newly built `OptionsProvider`.
|
66
|
+
def build: () -> OptionsProvider
|
67
|
+
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: 0.6.
|
4
|
+
version: 0.6.1
|
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-02-
|
11
|
+
date: 2025-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.5.
|
19
|
+
version: 0.5.11851
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.5.
|
26
|
+
version: 0.5.11851
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake-compiler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,34 +38,48 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.2.9
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rbs
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.8.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.8.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: sorbet
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.5.
|
61
|
+
version: 0.5.11851
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.5.
|
68
|
+
version: 0.5.11851
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: tapioca
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.16.
|
75
|
+
version: 0.16.11
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.16.
|
82
|
+
version: 0.16.11
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: test-unit
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +109,7 @@ files:
|
|
95
109
|
- lib/optify_ruby/base_config.rb
|
96
110
|
- lib/optify_ruby/implementation.rb
|
97
111
|
- rbi/optify.rbi
|
112
|
+
- sig/optify.rbs
|
98
113
|
homepage: https://github.com/juharris/optify
|
99
114
|
licenses:
|
100
115
|
- MIT
|