Class: GmailExtractor::EmailProgressbar

Inherits:
Object
  • Object
show all
Defined in:
lib/gmail_extractor/email_progressbar.rb

Overview

Simple printer proxy to enable tracking the progress with a progress bar transparently.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(printer) ⇒ EmailProgressbar

Returns a new instance of EmailProgressbar.



10
11
12
# File 'lib/gmail_extractor/email_progressbar.rb', line 10

def initialize(printer)
  @printer = printer
end

Instance Attribute Details

#printerObject

Returns the value of attribute printer.



8
9
10
# File 'lib/gmail_extractor/email_progressbar.rb', line 8

def printer
  @printer
end

Instance Method Details

#email(email) ⇒ Object



23
24
25
26
# File 'lib/gmail_extractor/email_progressbar.rb', line 23

def email(email)
  printer.email(email)
  @progress_bar.inc
end


18
19
20
21
# File 'lib/gmail_extractor/email_progressbar.rb', line 18

def footer
  printer.footer
  @progress_bar.finish
end

#headerObject



14
15
16
# File 'lib/gmail_extractor/email_progressbar.rb', line 14

def header
  printer.header
end

#label(label, limit) ⇒ Object



28
29
30
31
32
# File 'lib/gmail_extractor/email_progressbar.rb', line 28

def label(label,limit)
  printer.label(label,limit)
  total_count = limit || label.count
  @progress_bar = ProgressBar.new("emails",total_count)
end