class AbstractImporter::Reporters::BaseReporter
Attributes
io[R]
Public Class Methods
new(io)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 6 def initialize(io) @io = io end
Public Instance Methods
batch_inserted(size)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 44 def batch_inserted(size) end
count_error(message)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 52 def count_error(message) end
count_notice(message)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 49 def count_notice(message) end
finish_all(importer, ms)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 16 def finish_all(importer, ms) io.puts "\n\nFinished in #{distance_of_time(ms)}" end
finish_collection(collection, summary)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 30 def finish_collection(collection, summary) end
finish_setup(importer, ms)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 20 def finish_setup(importer, ms) end
finish_teardown(importer, ms)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 23 def finish_teardown(importer, ms) end
record_created(record)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 35 def record_created(record) end
record_failed(record, hash)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 38 def record_failed(record, hash) end
record_skipped(hash)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 41 def record_skipped(hash) end
start_all(importer)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 12 def start_all(importer) io.puts "Importing #{importer.describe_source} to #{importer.describe_destination}\n" end
start_collection(collection)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 26 def start_collection(collection) io.puts "\n#{("="*80)}\nImporting #{collection.name}\n#{("="*80)}\n" end
Protected Instance Methods
distance_of_time(milliseconds)
click to toggle source
# File lib/abstract_importer/reporters/base_reporter.rb, line 59 def distance_of_time(milliseconds) milliseconds = milliseconds.to_i seconds = milliseconds / 1000 milliseconds %= 1000 minutes = seconds / 60 seconds %= 60 hours = minutes / 60 minutes %= 60 days = hours / 24 hours %= 24 time = [] time << "#{days} days" unless days.zero? time << "#{hours} hours" unless hours.zero? time << "#{minutes} minutes" unless minutes.zero? time << "#{seconds}.#{milliseconds.to_s.rjust(3, "0")} seconds" time.join(", ") end