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

# Extracted from shrine/plugins/determine_mime_type.rb
module FileValidators
  class MimeTypeAnalyzer
    SUPPORTED_TOOLS = %i[fastimage file filemagic mimemagic marcel mime_types mini_mime].freeze
    MAGIC_NUMBER    = 256 * 1024

    def initialize(tool)
      raise Error, "unknown mime type analyzer #{tool.inspect
    
    def extract_with_file(io)
      require 'open3'

      return nil if io.eof? # file command returns "application/x-empty" for empty files

      Open3.popen3(*%W[file --mime-type --brief -]) do |stdin, stdout, stderr, thread|
        begin
          IO.copy_stream(io, stdin.binmode)
        rescue Errno::EPIPE
        end
        stdin.close

        status = thread.value

        raise Error, "file command failed to spawn: #{stderr.read}" if status.nil?
        raise Error, "file command failed: #{stderr.read}" unless status.success?
        $stderr.print(stderr.read)

        stdout.read.strip
      end