class EntryCountProgressMeter

Progress meter that prints the number of entries parsed every (n) lines.

Public Class Methods

new() click to toggle source
Calls superclass method ProgressMeter::new
# File lib/progress.rb, line 10
def initialize
    # 'period' is how many entries we wait between printing output.  So if 'period' is 10 000,
    # we'll print output every 10 000 lines.
    @_period = 10000
    super
end

Public Instance Methods

output_progress(entry) click to toggle source

Outputs the number of entries that have been parsed so far (every once in a while).

‘entry’ should be the latest log entry to be parsed, in hash form.

# File lib/progress.rb, line 20
def output_progress(entry)
    @_entry_count += 1
    if @_entry_count % @_period == 0
        puts "Processed %d entries" % [@_entry_count]
    end
end