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(server, params) ⇒ Gatherer

Returns a new instance of Gatherer.



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

def initialize(server, params)
  @requests = params[:requests]
  @server = server
end

Instance Method Details

#startObject



16
17
18
19
20
# File 'lib/web_fetch/gatherer.rb', line 16

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