From 26ea24216ee0ff04c67a46d67db3c996029c4c1d Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Tue, 21 Feb 2023 19:02:41 +0100 Subject: [PATCH] Fix **options --- lib/docs/core/request.rb | 2 +- lib/docs/core/requester.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/docs/core/request.rb b/lib/docs/core/request.rb index 2a7f96c6..b1e26e68 100644 --- a/lib/docs/core/request.rb +++ b/lib/docs/core/request.rb @@ -13,7 +13,7 @@ module Docs request.run end - def initialize(url, **options) + def initialize(url, options = {}) super url.to_s, DEFAULT_OPTIONS.merge(options) end diff --git a/lib/docs/core/requester.rb b/lib/docs/core/requester.rb index ed8bafcb..28b7db2d 100644 --- a/lib/docs/core/requester.rb +++ b/lib/docs/core/requester.rb @@ -4,9 +4,9 @@ module Docs attr_reader :request_options - def self.run(urls, **options, &block) + def self.run(urls, options = {}, &block) urls = urls.dup - requester = new(**options) + requester = new(options) requester.on_response(&block) if block_given? requester.on_response do # cheap hack to ensure root page is processed first if urls @@ -19,16 +19,16 @@ module Docs requester end - def initialize(**options) + def initialize(options = {}) @request_options = options.extract!(:request_options)[:request_options].try(:dup) || {} options[:max_concurrency] ||= 20 options[:pipelining] = 0 super end - def request(urls, **options, &block) + def request(urls, options = {}, &block) requests = [urls].flatten.map do |url| - build_and_queue_request(url, **options, &block) + build_and_queue_request(url, options, &block) end requests.length == 1 ? requests.first : requests end @@ -46,7 +46,7 @@ module Docs private - def build_and_queue_request(url, **options, &block) + def build_and_queue_request(url, options = {}, &block) request = Request.new(url, **request_options.merge(options)) request.on_complete(&block) if block queue(request)