This processor reports the number of records processed.
Create a count-records report.
Recognized options include:
:label
Label to use for the report. If provided, the report is returned as a string of the form “#{label}#{value}” If set to nil or absent, the report is returned as an integer.
# File lib/sawmill/record_processor/count_records.rb, line 57 def initialize(opts_={}) @label = opts_[:label] @finished = false @count = 0 end
# File lib/sawmill/record_processor/count_records.rb, line 69 def extra_entry(entry_) true end
# File lib/sawmill/record_processor/count_records.rb, line 73 def finish @finished = true @label ? "#{@label}#{@count}" : @count end
# File lib/sawmill/record_processor/count_records.rb, line 64 def record(record_) @count += 1 unless @finished true end