optify-config 1.15.2-arm64-darwin → 1.16.0-arm64-darwin
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.rb +1 -1
- data/lib/optify_ruby/3.2/optify_ruby.bundle +0 -0
- data/lib/optify_ruby/3.4/optify_ruby.bundle +0 -0
- data/lib/optify_ruby/provider_module.rb +22 -20
- data/lib/optify_ruby/watcher_implementation.rb +1 -1
- data/rbi/optify.rbi +12 -0
- data/sig/optify.rbs +2 -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: 9383437ad25eff80824038a4cf9e484577eec5702891243d18e10b3d61dff186
         | 
| 4 | 
            +
              data.tar.gz: 3c0f3472609f462f68cf93f940353459a0dea8c99aead366533a2dbe6f38be7a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 188d638d949e9989c8deba5da789465929ffb630dbc09c3216cef0bf023a87c28759b50900e545018f4d9f773c5a8382b05e0854a6f7ab3378c5454e68104768
         | 
| 7 | 
            +
              data.tar.gz: '0962d70021c874c52c020b8dfc04941d947ca062353f0351934d9bb37ee795c85f975177ad851b06289f34c43ec3a2855a597baaadf4fca4b4e655cf238599f0'
         | 
    
        data/lib/optify.rb
    CHANGED
    
    | @@ -15,7 +15,7 @@ require_relative 'optify_ruby/watcher_implementation' | |
| 15 15 | 
             
            # but that doesn't work when building for multiple versions of Ruby.
         | 
| 16 16 | 
             
            # So we have to do this which is similar to something from 'https://github.com/matsadler/halton-rb/blob/main/lib/halton.rb'.
         | 
| 17 17 | 
             
            begin
         | 
| 18 | 
            -
              ruby_version =  | 
| 18 | 
            +
              ruby_version = RUBY_VERSION.match(/\d+\.\d+/)&.[](0)
         | 
| 19 19 | 
             
              require_relative "optify_ruby/#{ruby_version}/optify_ruby"
         | 
| 20 20 | 
             
            rescue LoadError
         | 
| 21 21 | 
             
              begin
         | 
| Binary file | 
| Binary file | 
| @@ -6,8 +6,6 @@ require 'sorbet-runtime' | |
| 6 6 | 
             
            module Optify
         | 
| 7 7 | 
             
              # @!visibility private
         | 
| 8 8 | 
             
              module ProviderModule
         | 
| 9 | 
            -
                extend T::Sig
         | 
| 10 | 
            -
             | 
| 11 9 | 
             
                #: (Array[String] feature_names) -> Array[String]
         | 
| 12 10 | 
             
                def get_canonical_feature_names(feature_names)
         | 
| 13 11 | 
             
                  # Try to optimize a typical case where there are just a few features.
         | 
| @@ -40,7 +38,7 @@ module Optify | |
| 40 38 | 
             
                  end
         | 
| 41 39 | 
             
                  result.freeze
         | 
| 42 40 |  | 
| 43 | 
            -
                  @features_with_metadata =  | 
| 41 | 
            +
                  @features_with_metadata = result
         | 
| 44 42 | 
             
                  result
         | 
| 45 43 | 
             
                end
         | 
| 46 44 |  | 
| @@ -71,13 +69,14 @@ module Optify | |
| 71 69 | 
             
                                   get_options_json(key, feature_names)
         | 
| 72 70 | 
             
                                 end
         | 
| 73 71 | 
             
                  hash = JSON.parse(options_json)
         | 
| 74 | 
            -
                   | 
| 72 | 
            +
                  config_class #: as untyped
         | 
| 73 | 
            +
                    .from_hash(hash)
         | 
| 75 74 | 
             
                end
         | 
| 76 75 |  | 
| 77 76 | 
             
                #: -> void
         | 
| 78 77 | 
             
                def _init
         | 
| 79 | 
            -
                  @cache =  | 
| 80 | 
            -
                  @features_with_metadata =  | 
| 78 | 
            +
                  @cache = {} #: Hash[untyped, untyped]?
         | 
| 79 | 
            +
                  @features_with_metadata = nil #: Hash[String, OptionsMetadata]?
         | 
| 81 80 | 
             
                end
         | 
| 82 81 |  | 
| 83 82 | 
             
                NOT_FOUND_IN_CACHE_SENTINEL = Object.new
         | 
| @@ -93,28 +92,31 @@ module Optify | |
| 93 92 | 
             
                  end
         | 
| 94 93 |  | 
| 95 94 | 
             
                  init unless @cache
         | 
| 96 | 
            -
                  feature_names = get_canonical_feature_names(feature_names) unless preferences&.skip_feature_name_conversion
         | 
| 97 95 |  | 
| 98 | 
            -
                   | 
| 99 | 
            -
             | 
| 96 | 
            +
                  if preferences.nil?
         | 
| 97 | 
            +
                    feature_names = get_filtered_features(feature_names, GetOptionsPreferences.new)
         | 
| 98 | 
            +
                  elsif !preferences.skip_feature_name_conversion || preferences.constraints_json
         | 
| 99 | 
            +
                    feature_names = get_filtered_features(feature_names, preferences)
         | 
| 100 | 
            +
                  end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                  # Features are filtered, so we don't need the constraints in the cache key.
         | 
| 103 | 
            +
                  cache_key = [key, feature_names, config_class]
         | 
| 104 | 
            +
                  result = @cache #: as !nil
         | 
| 105 | 
            +
                           .fetch(cache_key, NOT_FOUND_IN_CACHE_SENTINEL)
         | 
| 100 106 | 
             
                  return result unless result.equal?(NOT_FOUND_IN_CACHE_SENTINEL)
         | 
| 101 107 |  | 
| 102 108 | 
             
                  # Handle a cache miss.
         | 
| 103 109 |  | 
| 104 | 
            -
                  # We can avoid converting the features names because they're already converted, if that was desired.
         | 
| 105 | 
            -
                   | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 108 | 
            -
                   | 
| 109 | 
            -
                    # Indeed the copying of preferences could be wasteful, but this only happens on a cache miss
         | 
| 110 | 
            -
                    # and when no custom preferences are provided.
         | 
| 111 | 
            -
                    preferences = preferences.dup
         | 
| 112 | 
            -
                    preferences.skip_feature_name_conversion = true
         | 
| 113 | 
            -
                  end
         | 
| 110 | 
            +
                  # We can avoid converting the features names because they're already converted from filtering above, if that was desired.
         | 
| 111 | 
            +
                  # We don't need the constraints because we filtered the features above.
         | 
| 112 | 
            +
                  # We already know there are no overrides because we checked above.
         | 
| 113 | 
            +
                  preferences = GetOptionsPreferences.new
         | 
| 114 | 
            +
                  preferences.skip_feature_name_conversion = true
         | 
| 114 115 |  | 
| 115 116 | 
             
                  result = get_options(key, feature_names, config_class, nil, preferences)
         | 
| 116 117 |  | 
| 117 | 
            -
                   | 
| 118 | 
            +
                  @cache #: as !nil
         | 
| 119 | 
            +
                    .[]= cache_key, result
         | 
| 118 120 | 
             
                end
         | 
| 119 121 | 
             
              end
         | 
| 120 122 | 
             
            end
         | 
    
        data/rbi/optify.rbi
    CHANGED
    
    | @@ -183,6 +183,18 @@ module Optify | |
| 183 183 | 
             
                sig { params(canonical_feature_name: String).returns(T.nilable(OptionsMetadata)) }
         | 
| 184 184 | 
             
                def get_feature_metadata(canonical_feature_name); end
         | 
| 185 185 |  | 
| 186 | 
            +
                # Filters `feature_names` based on the preferences,
         | 
| 187 | 
            +
                # such as the `preferences`'s constraints.
         | 
| 188 | 
            +
                # Also converts the feature names to canonical feature names if `preferences.skip_feature_name_conversion` is `false`.
         | 
| 189 | 
            +
                sig do
         | 
| 190 | 
            +
                  params(
         | 
| 191 | 
            +
                    feature_names: T::Array[String],
         | 
| 192 | 
            +
                    preferences: GetOptionsPreferences
         | 
| 193 | 
            +
                  )
         | 
| 194 | 
            +
                    .returns(T::Array[String])
         | 
| 195 | 
            +
                end
         | 
| 196 | 
            +
                def get_filtered_features(feature_names, preferences); end
         | 
| 197 | 
            +
             | 
| 186 198 | 
             
                # Fetches options based on the provided key and feature names.
         | 
| 187 199 | 
             
                #
         | 
| 188 200 | 
             
                # @param key The key to fetch options for.
         | 
    
        data/sig/optify.rbs
    CHANGED
    
    | @@ -142,6 +142,8 @@ module Optify::ProviderModule | |
| 142 142 | 
             
              # @return The metadata for the feature.
         | 
| 143 143 | 
             
              def get_feature_metadata: (String canonical_feature_name) -> OptionsMetadata?
         | 
| 144 144 |  | 
| 145 | 
            +
              def get_filtered_features: (::Array[String] feature_names, GetOptionsPreferences preferences) -> ::Array[String]
         | 
| 146 | 
            +
             | 
| 145 147 | 
             
              def get_options: [Config] (String key, ::Array[String] feature_names, T::Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
         | 
| 146 148 |  | 
| 147 149 | 
             
              # Fetches options in JSON format based on the provided key and feature names.
         | 
    
        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. | 
| 4 | 
            +
              version: 1.16.0
         | 
| 5 5 | 
             
            platform: arm64-darwin
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Justin D. Harris
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2025-09- | 
| 11 | 
            +
            date: 2025-09-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: sorbet-runtime
         |