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: solver.rb
    path of file: ./repos/gel/lib/gel/pub_grub
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require_relative "source"

class Gel::PubG
    
  def next_package_to_try
    self.solution.unsatisfied.min_by do |term|
      package = term.package
      versions = self.source.versions_for(package, term.constraint.range)

      if @strategy
        @strategy.package_priority(package, versions) + @package_depth[package]
      else
        @package_depth[package]
      end * 1000 + versions.count
    end.package
  end

  def each_resolved_package(&block)
    result.each do |package, version|
      next if package.is_a?(Gel::PubGrub::Package::Pseudo)
      yield package, version
    end
  end
end