Class: DaimonSkycrawlers::Processor::Default

Inherits:
Base
  • Object
show all
Defined in:
lib/daimon_skycrawlers/processor/default.rb

Overview

Very simple processor

Instance Attribute Summary

Attributes inherited from Base

#storage

Instance Method Summary collapse

Methods inherited from Base

#initialize, #process

Methods included from Configurable

#configure

Methods included from Callbacks

#after_process, #before_process, #clear_after_process_callbacks, #clear_before_process_callbacks, #run_after_process_callbacks, #run_before_process_callbacks

Constructor Details

This class inherits a constructor from DaimonSkycrawlers::Processor::Base

Instance Method Details

#call(message) ⇒ Object

Display page information



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/daimon_skycrawlers/processor/default.rb', line 13

def call(message)
  page = storage.read(message)
  headers = JSON.parse(page.headers)
  headers_string = headers.map {|key, value| "  #{key}: #{value}" }.join("\n")
  dumped_message = <<LOG
URL: #{page.url}
Body: #{page.body.bytesize} bytes
Headers:
#{headers_string}
LOG
  log.info(dumped_message)
end