optify-config 0.6.0-aarch64-linux → 0.6.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: 21b12ff64f2164489a98a426b605226c24e93ae5b0225c4b8c642181e8546eda
4
- data.tar.gz: f88ef628555791371db2366c13c8c19cae7b4b34da466f41f8620166c919a6bf
3
+ metadata.gz: fb626ab6998da7c88c0e631b5e35ac3ca11b4d75693668478665a103899ee008
4
+ data.tar.gz: 14b0ac252fb2a3396e7d050b5ba85f1fc2d65be74fb30e27d055d2503315ca4f
5
5
  SHA512:
6
- metadata.gz: 3feb7612aadd49633c8b0869467fe99bbf942224fff827a22b7c15916998e4a5432c2120200eaed006313e78a35baa8c98d17df5dd66507b55b6cd98bfaf75de
7
- data.tar.gz: c9cde90b287fd2cd0c6e994778c8f1621933f4aa742d7d7adcadbadf870e927f4d38cde8734eff146984dcbc908c1329fb61540c7f10d3c4db00e7a905fd049b
6
+ metadata.gz: d0e37518617f4b7346ba573eb2f6e9674861c465d0d8ed5ccf729f2a273aa8075c56f8b364de2137b32c6a82a9efc02212281ef3fed5dcf4a2f6ad2acd066998
7
+ data.tar.gz: 605378e7549fa30ccebaf76ad36aa41281056e8d6f7bdd2397da718467178ef279b42bfd92a8db99bd09a8a237ab7aab64f88a10ead5ad6464b7bbf0b50b8806
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 [Hash] The hash to create the instance from.
22
+ # @param hash The hash to create the instance from.
23
23
  # @return The new instance.
24
- sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
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
- sig { params(value: T.untyped, type: T.untyped).returns(T.untyped) }
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
- sig do
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 [String] the key to fetch options for.
24
- # @param feature_names [Array<String>] The enabled feature names to use to build the options.
25
- # @param config_class [ConfigType] The class of the configuration to return.
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 [CacheOptions] Set this if caching is desired. Only very simple caching is supported for now.
28
- # @param preferences [GetOptionsPreferences] The preferences to use when getting options.
29
- # @return [ConfigType] The options.
30
- sig do
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
- sig { returns(OptionsProvider) }
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
- sig do
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 [Hash] The hash to create the instance from.
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 [String] the key to fetch options for.
50
- # @param feature_names [Array<String>] The enabled feature names to use to build the options.
51
- # @param config_class [ConfigType] The class of the configuration to return.
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 [CacheOptions] Set this if caching is desired. Only very simple caching is supported for now.
54
- # @param preferences [GetOptionsPreferences] The preferences to use when getting options.
55
- # @return [ConfigType] The options.
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.0
4
+ version: 0.6.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-02-17 00:00:00.000000000 Z
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.11796
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.11796
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.11796
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.11796
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.8
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.8
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