Class: AbstractImporter::Reporters::ProgressReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- AbstractImporter::Reporters::ProgressReporter
show all
- Defined in:
- lib/abstract_importer/reporters/progress_reporter.rb
Instance Attribute Summary
Attributes inherited from BaseReporter
#io
Instance Method Summary
collapse
#count_error, #count_notice, #finish_collection, #finish_teardown, #initialize, #start_all
Instance Method Details
#batch_inserted(size) ⇒ Object
33
34
35
|
# File 'lib/abstract_importer/reporters/progress_reporter.rb', line 33
def batch_inserted(size)
pbar.inc size
end
|
#finish_all(importer, ms) ⇒ Object
14
15
16
17
|
# File 'lib/abstract_importer/reporters/progress_reporter.rb', line 14
def finish_all(importer, ms)
pbar.finish
io.puts "Finished in #{distance_of_time(ms)}"
end
|
#finish_setup(importer, ms) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/abstract_importer/reporters/progress_reporter.rb', line 7
def finish_setup(importer, ms)
total = importer.collections.reduce(0) do |total, collection|
total + importer.count_collection(collection)
end
@pbar = ProgressBar.new("progress", total)
end
|
#record_created(record) ⇒ Object
25
26
27
|
# File 'lib/abstract_importer/reporters/progress_reporter.rb', line 25
def record_created(record)
pbar.inc
end
|
#record_failed(record, hash) ⇒ Object
29
30
31
|
# File 'lib/abstract_importer/reporters/progress_reporter.rb', line 29
def record_failed(record, hash)
pbar.inc
end
|
#start_collection(collection) ⇒ Object
19
20
21
|
# File 'lib/abstract_importer/reporters/progress_reporter.rb', line 19
def start_collection(collection)
end
|