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: bin.rb
    path of file: ./repos/tiny_tds/lib/tiny_tds
    
    the code of the file until where you have to start completion: require_relative './version'
require_relative '.
    
    def which
      search_paths.each do |path|
        @exts.each do |ext|
          exe = File.expand_path File.join(path, "#{name}#{ext}"), @root
          next if exe == @binstub
          next unless File.executable?(exe)
          next unless binary?(exe)
          return exe
        end
      end
      nil
    end