lib/parse/client/batch.rb
def submit(segment = 50)
      @responses = []
      @requests.uniq!(&:signature)
      @responses = @requests.each_slice(segment).to_a.threaded_map(2) do |slice|
         client.batch_request( BatchOperation.new(slice) )
      end
      @responses.flatten!
      #puts "Requests: #{@requests.count} == Response: #{@responses.count}"
      @requests.zip(@responses).each(&Proc.new) if block_given?
      @responses
    end
def submit(segment = 50)
      @responses = []
      @requests.uniq!(&:signature)
      @responses = @requests.each_slice(segment).to_a.threaded_map(2) do |slice|
         client.batch_request( BatchOperation.new(slice) )
      end
      @responses.flatten!
      #puts "Requests: #{@requests.count} == Response: #{@responses.count}"
      @requests.zip(@responses).each(&Proc.new) if block_given?
      @responses
    end
Submit the batch operation in chunks until they are all complete. In general,
 Parse limits requests in each batch to 50 and it is possible that a {BatchOperation}
 instance contains more than 50 requests. This method will slice up the array of
 request and send them based on the `segment` amount until they have all been submitted.
 @param segment [Integer] the number of requests to send in each batch. Default 50.
 @return [Array<Parse::Response>] the corresponding set of responses for
  each request in the batch.