Sha256: a24be07c67022869e0ca8a7b087bd10a84c160774de619e7069ed1f8d3661bd7
Contents?: true
Size: 507 Bytes
Versions: 3
Compression:
Stored size: 507 Bytes
Contents
# frozen_string_literal: true module Wayfarer module Middleware class Normalize extend Base def call(task) yield if block_given? task.metadata.staged_urls = SortedSet.new(normalized_urls(task).compact) end private def normalized_urls(task) task.metadata.staged_urls.map(&method(:normalize)) end def normalize(url) NormalizeUrl.process(url) rescue NormalizeUrl::InvalidURIError nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wayfarer-0.4.6 | lib/wayfarer/middleware/normalize.rb |
wayfarer-0.4.5 | lib/wayfarer/middleware/normalize.rb |
wayfarer-0.4.4 | lib/wayfarer/middleware/normalize.rb |