Class: Wayfarer::Middleware::UriParser

Inherits:
Object
  • Object
show all
Extended by:
Base
Defined in:
lib/wayfarer/middleware/uri_parser.rb

Defined Under Namespace

Modules: API

Constant Summary

Constants included from Base

Base::API_MODULE

Instance Method Summary collapse

Methods included from Base

api, lazy

Instance Method Details

#call(task) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/wayfarer/middleware/uri_parser.rb', line 18

def call(task)
  # TODO: Test
  task[:uri] ||= begin
    Addressable::URI.parse(task.url).normalize
  rescue Addressable::URI::InvalidURIError => e
    return log(:invalid, task, message: e.message)
  end

  yield if block_given?
end