Sha256: f0348698058c78b25adc5117ce4e15ae3f5cfb25e7573f38d6dd7e8913d547c3

Contents?: true

Size: 476 Bytes

Versions: 4

Compression:

Stored size: 476 Bytes

Contents

# frozen_string_literal: true

module Wayfarer
  module Middleware
    class Stage
      module API
        def stage(urls)
          Array.wrap(urls).each { |url| task.metadata.staged_urls.add(url) }
        end
      end

      def call(task)
        task.metadata.staged_urls = SortedSet.new

        yield if block_given?

        task.metadata.staged_urls.each do |url|
          task.job.class.crawl_later(url, batch: task.batch)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wayfarer-0.4.3 lib/wayfarer/middleware/stage.rb
wayfarer-0.4.2 lib/wayfarer/middleware/stage.rb
wayfarer-0.4.1 lib/wayfarer/middleware/stage.rb
wayfarer-0.4.0 lib/wayfarer/middleware/stage.rb