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: constants.rb
    path of file: ./repos/ransack/lib/ransack
    
    the code of the file until where you have to start completion: module Ransack
  module Constants
  
    
    def escape_wildcards(unescaped)
      case ActiveRecord::Base.connection.adapter_name
      when "Mysql2".freeze
        # Necessary for MySQL
        unescaped.to_s.gsub(/([\\%_])/, '\\\\\\1')
      when "PostgreSQL".freeze
        # Necessary for PostgreSQL
        unescaped.to_s.gsub(/([\\%_.])/, '\\\\\\1')
      else
        unescaped
      end