You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: gem_version_promoter.rb
    path of file: ./repos/artichoke/artichoke-backend/vendor/ruby/lib/bundler
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Bundler
  # This class contains all of the logic for determining the next version of a
  # Gem to update to based on the requested level (patch, minor, major).
  # Primarily designed to work with Resolver which will provide it the list of
  # available dependency versions as found in its index, before returning it to
  # to the resolution engine to select the best version.
  class GemVersionPromoter
    DEBUG = ENV["BUNDLER_DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER"]

    attr_read
    
    def sort_versions(dep, spec_groups)
      before_result = "before sort_versions: #{debug_format_result(dep, spec_groups).inspect}" if DEBUG

      @sort_versions[dep] ||= begin
        gem_name = dep.name

        # An Array per version returned, different entries for different platforms.
        # We only need the version here so it's ok to hard code this to the first instance.
        locked_spec = locked_specs[gem_name].first

        if strict
          filter_dep_specs(spec_groups, locked_spec)
        else
          sort_dep_specs(spec_groups, locked_spec)
        end.tap do |specs|
          if DEBUG
            puts before_result
            puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
          end
        end