lib/each_in_batches.rb
# Allow caller to override verbosity when called from console
Allow caller to override verbosity when called from console
Allow caller to override verbosity when called from console
def print_results(verbose = self.verbose)
      printf "Results..."
      printf "Average time per complete batch was %.1f seconds\n", (self.total_time/Float(self.num_runs)) unless self.num_runs < 1
      printf "Total time elapsed was %.1f seconds, about #{self.elapsed_time/60} minute(s)\n", (self.elapsed_time)
      if self.backwards 
        puts "Total # of #{self.arel.table} - Before: #{self.total_records}"
        puts "Total # of #{self.arel.table} - After : #{self.arel.count}"
      end
    end
def print_results ( verbose = self . verbose ) printf "Results..." printf "Average time per complete batch was %.1f seconds\n" , ( self . total_time / Float ( self . num_runs ) ) unless self . num_runs < 1 printf "Total time elapsed was %.1f seconds, about #{self.elapsed_time/60} minute(s)\n" , ( self . elapsed_time ) if self . backwards puts "Total # of #{self.arel.table} - Before: #{self.total_records}" puts "Total # of #{self.arel.table} - After : #{self.arel.count}" end end
Allow caller to override verbosity when called from console
Allow caller to override verbosity when called from console
# When backwards might be deleting records # With a large number of batches this is far too verbose, but don't want to introduce a more complicated verbosity setting. # if verbose? #   puts "Completion times for each batch:" #   self.completion_times.each do |x| #     puts "Batch #{x[0]}: Time Elapsed: #{x[1][:elapsed]}s, Begin: #{x[1][:begin_time].strftime("%m.%d.%Y %I:%M:%S %p")}, End: #{x[1][:end_time].strftime("%m.%d.%Y %I:%M:%S %p")}" #   end # end
verbose
<not_specific>