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

module Dynamoid
  module Criteria
    # @private
    class KeyFieldsDetector
      class Query
        def initialize(where_conditions)
          @where_conditions
    
      def match_global_secondary_index
        gsi = @source.global_secondary_indexes.values.find do |i|
          @query.contain_with_eq_operator?(i.hash_key) && i.projected_attributes == :all
        end

        if gsi.present?
          {
            hash_key: gsi.hash_key,
            range_key: gsi.range_key,
            index_name: gsi.name,
          }
        end