Class: WebFetch::Gatherer

Inherits:
Object
  • Object
show all
Includes:
Validatable
Defined in:
lib/web_fetch/gatherer.rb

Overview

Handles requests to gather URLs and delegates to the EventMachine web server

Constant Summary collapse

HASHABLE_KEYS =
i[url query_string headers method].freeze

Instance Attribute Summary

Attributes included from Validatable

#errors

Instance Method Summary collapse

Methods included from Validatable

#valid?

Constructor Details

#initialize(storage, params, logger = Logger, http = EM::HttpRequest) ⇒ Gatherer

Returns a new instance of Gatherer.



11
12
13
14
15
16
# File 'lib/web_fetch/gatherer.rb', line 11

def initialize(storage, params, logger = Logger, http = EM::HttpRequest)
  @requests = params[:requests]
  @storage = storage
  @logger = logger
  @http = http
end

Instance Method Details

#startObject



18
19
20
21
22
# File 'lib/web_fetch/gatherer.rb', line 18

def start
  tagged = { requests: tag_requests }
  gather(tagged[:requests])
  tagged
end