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: sortable.rb
    path of file: ./repos/violet_rails/app/models/concerns/jsonb_search
    
    the code of the file until where you have to start completion: # Search Jsonb fields
# Simple query format => { name: 'violet' }
# Extended format => { name: { value: 'violet', opti
    
      def self.build_sort_query(query)
        q_string = query.map do |key, value|
          unless value.is_a? Hash
            "#{key} #{value}"
          else 
            generate_nested_sort_query(value, key)
          end
        end.join(', ')

        Arel.sql(q_string)
      end