optify-config 0.6.0-aarch64-linux → 0.7.0-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: 2113d5e70da1b30cd1ebd475bbf0fe15b0d3170dda85c02c1a4560536fdf3e6f
4
+ data.tar.gz: a6328e06f100b0762bbe635ccbd787325db0564c78192a959ff8687fda3f3b59
5
5
  SHA512:
6
- metadata.gz: 3feb7612aadd49633c8b0869467fe99bbf942224fff827a22b7c15916998e4a5432c2120200eaed006313e78a35baa8c98d17df5dd66507b55b6cd98bfaf75de
7
- data.tar.gz: c9cde90b287fd2cd0c6e994778c8f1621933f4aa742d7d7adcadbadf870e927f4d38cde8734eff146984dcbc908c1329fb61540c7f10d3c4db00e7a905fd049b
6
+ metadata.gz: 47cea1015e29cc7a6efdac9371c1c7d87f1cf46114d49f829898e18995b0fe3fd041656d6e3724a5f885fd05253b5973df72c0beffdc19ef5b65c0610c9e7f18
7
+ data.tar.gz: c74f7d52ed02792891ee9a71fca2472003804b97c0a50f4f62d4ca91749a4b6724fd7420bac9153edfcc6e259f287cca49c135a43f4832a48f179e73adb4e910
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
@@ -36,6 +36,17 @@ module Optify
36
36
 
37
37
  # Provides configurations based on keys and enabled feature names.
38
38
  class OptionsProvider
39
+ # @return All of the canonical feature names.
40
+ sig { returns(T::Array[String]) }
41
+ def features; end
42
+
43
+ # @return All of the keys and values for the the features.
44
+ sig do
45
+ params(feature_names: T::Array[String], preferences: GetOptionsPreferences)
46
+ .returns(String)
47
+ end
48
+ def get_all_options_json(feature_names, preferences); end
49
+
39
50
  # Map an alias or canonical feature name (perhaps derived from a file name) to a canonical feature name.
40
51
  # Canonical feature names map to themselves.
41
52
  #
@@ -46,13 +57,13 @@ module Optify
46
57
 
47
58
  # Fetches options based on the provided key and feature names.
48
59
  #
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.
60
+ # @param key The key to fetch options for.
61
+ # @param feature_names The enabled feature names to use to build the options.
62
+ # @param config_class The class of the configuration to return.
52
63
  # 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.
64
+ # @param cache_options Set this if caching is desired. Only very simple caching is supported for now.
65
+ # @param preferences The preferences to use when getting options.
66
+ # @return The options.
56
67
  sig do
57
68
  type_parameters(:Config)
58
69
  .params(
data/sig/optify.rbs ADDED
@@ -0,0 +1,72 @@
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
+ # @return All of the canonical feature names.
35
+ def features: () -> ::Array[String]
36
+
37
+ def get_all_options_json: (::Array[String] feature_names, GetOptionsPreferences preferences) -> String
38
+
39
+ # Map an alias or canonical feature name (perhaps derived from a file name) to a canonical feature name.
40
+ # Canonical feature names map to themselves.
41
+ #
42
+ # @param feature_name The name of an alias or a feature.
43
+ # @return The canonical feature name.
44
+ def get_canonical_feature_name: (String feature_name) -> String
45
+
46
+ def get_options: [Config] (String key, ::Array[String] feature_names, T::Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
47
+
48
+ # Fetches options in JSON format based on the provided key and feature names.
49
+ #
50
+ # @param key [String] the key to fetch options for.
51
+ # @param feature_names [Array<String>] The enabled feature names to use to build the options.
52
+ # @return [String] the options in JSON.
53
+ def get_options_json: (String key, ::Array[String] feature_names) -> String
54
+
55
+ def get_options_json_with_preferences: (String key, ::Array[String] feature_names, GetOptionsPreferences preferences) -> String
56
+
57
+ # (Optional) Eagerly initializes the cache.
58
+ # @return [OptionsProvider] `self`.
59
+ def init: () -> OptionsProvider
60
+ end
61
+
62
+ # A builder for creating an `OptionsProvider` instance.
63
+ class Optify::OptionsProviderBuilder
64
+ # Adds a directory to the builder.
65
+ #
66
+ # @param path [String] The path of the directory to add.
67
+ # @return [OptionsProviderBuilder] `self`.
68
+ def add_directory: (String path) -> OptionsProviderBuilder
69
+
70
+ # @return [OptionsProvider] A newly built `OptionsProvider`.
71
+ def build: () -> OptionsProvider
72
+ 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.7.0
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-03-03 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