Class: Docs::ScraperSubscriber

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

Instance Method Summary collapse

Methods inherited from Subscriber

subscribe_to

Instance Method Details

#ignore_response(event) ⇒ Object


13
14
15
16
17
# File 'lib/docs/subscribers/scraper_subscriber.rb', line 13

def ignore_response(event)
  msg = "Ignore:  #{format_url event.payload[:response].url}"
  msg << " [#{event.payload[:response].code}]" if event.payload[:response].respond_to?(:code)
  log(msg)
end

#process_response(event) ⇒ Object


19
20
21
# File 'lib/docs/subscribers/scraper_subscriber.rb', line 19

def process_response(event)
  log "Process: #{format_url event.payload[:response].url} [#{event.duration.round}ms]"
end

#queued(event) ⇒ Object Also known as: running


5
6
7
8
9
# File 'lib/docs/subscribers/scraper_subscriber.rb', line 5

def queued(event)
  event.payload[:urls].each do |url|
    log "Queue:   #{format_url url}"
  end
end