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: pub_sub_perf.rb
    path of file: ./repos/nats.rb/benchmark
    
    the code of the file until where you have to start completion: # Copyright 2010-2018 The NATS Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 
    
  def send_batch
    (0..$batch).each do
      $to_send -= 1
      if $to_send == 0
        NATS.publish($sub, $data) { display_final_results }
        return
      else
        NATS.publish($sub, $data)
      end
      printf('+') if $to_send.modulo($hash) == 0
    end