Class: Docs::ProgressBarSubscriber

Inherits:
Subscriber
  • Object
show all
Defined in:
lib/docs/subscribers/progress_bar_subscriber.rb

Instance Method Summary collapse

Methods inherited from Subscriber

subscribe_to

Instance Method Details

#ignore_response(event) ⇒ Object


21
22
23
# File 'lib/docs/subscribers/progress_bar_subscriber.rb', line 21

def ignore_response(event)
  @progress_bar.increment!
end

#process_response(event) ⇒ Object


17
18
19
# File 'lib/docs/subscribers/progress_bar_subscriber.rb', line 17

def process_response(event)
  @progress_bar.increment!
end

#queued(event) ⇒ Object


12
13
14
15
# File 'lib/docs/subscribers/progress_bar_subscriber.rb', line 12

def queued(event)
  @progress_bar.max += event.payload[:urls].length
  @progress_bar.write
end

#running(event) ⇒ Object


7
8
9
10
# File 'lib/docs/subscribers/progress_bar_subscriber.rb', line 7

def running(event)
  @progress_bar = ::ProgressBar.new event.payload[:urls].length
  @progress_bar.write
end