Class: TimeProgressMeter

Inherits:
ProgressMeter show all
Defined in:
lib/progress.rb

Instance Method Summary collapse

Constructor Details

#initializeTimeProgressMeter

Returns a new instance of TimeProgressMeter.



29
30
31
32
33
34
# File 'lib/progress.rb', line 29

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

Instance Method Details

#output_progress(entry) ⇒ Object

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.



39
40
41
42
43
44
# File 'lib/progress.rb', line 39

def output_progress(entry)
    @_entry_count += 1
    if @_entry_count % @_period == 0
        puts "Processed through %s" % [entry.fetch(:time)]
    end
end