class S3DataPacker::Summary

Public Instance Methods

batches() click to toggle source
# File lib/s3_data_packer/summary.rb, line 34
def batches
  stats[:batches] || 0
end
count_batch() click to toggle source
# File lib/s3_data_packer/summary.rb, line 17
def count_batch
  stats[:batches] ||= 0
  stats[:batches] += 1
end
count_item() click to toggle source
# File lib/s3_data_packer/summary.rb, line 7
def count_item
  stats[:total_items] ||= 0
  stats[:total_items] += 1
end
count_processed() click to toggle source
# File lib/s3_data_packer/summary.rb, line 12
def count_processed
  stats[:processed] ||= 0
  stats[:processed] += 1
end
elapsed() click to toggle source
# File lib/s3_data_packer/summary.rb, line 38
def elapsed
  stats[:elapsed]
end
flush!() click to toggle source
# File lib/s3_data_packer/summary.rb, line 42
def flush!
  output = [
    "Summary:",
    "Total Items: #{stats[:total_items]}",
    "Processed Items: #{stats[:processed]}",
    "Batches: #{stats[:batches]}",
    "Elapsed: #{stats[:elapsed]}"
  ].join("\n")
  reset!
  output
end
processed() click to toggle source
# File lib/s3_data_packer/summary.rb, line 30
def processed
  stats[:processed] || 0
end
reset!() click to toggle source
# File lib/s3_data_packer/summary.rb, line 54
def reset!
  @stats = {}
end
set_time(start_time, end_time) click to toggle source
# File lib/s3_data_packer/summary.rb, line 22
def set_time start_time, end_time
  stats[:elapsed] = "#{(end_time.to_i - start_time.to_i)} seconds"
end
stats() click to toggle source
# File lib/s3_data_packer/summary.rb, line 3
def stats
  @stats ||= {}
end
total_items() click to toggle source
# File lib/s3_data_packer/summary.rb, line 26
def total_items
  stats[:total_items] || 0
end