Class: NDD::UrlChecker::ThreadedUrlChecker

Inherits:
AbstractUrlChecker show all
Defined in:
lib/ndd/url_checker/threaded_url_checker.rb

Overview

An URL checker using threads to parallelize processing. Does not work on MRI.

Author:

  • David DIDIER

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delegate_checker: nil, parallelism: 10) ⇒ ThreadedUrlChecker

Create a new instance.

Parameters:



21
22
23
24
25
# File 'lib/ndd/url_checker/threaded_url_checker.rb', line 21

def initialize(delegate_checker: nil, parallelism: 10)
  @logger = Logging.logger[self]
  @delegate = delegate_checker || BlockingUrlChecker.new
  @parallelism = parallelism
end

Instance Attribute Details

#delegate#check (readonly)

the delegate URL checker.

Returns:

  • (#check)

    the current value of delegate



13
14
15
# File 'lib/ndd/url_checker/threaded_url_checker.rb', line 13

def delegate
  @delegate
end

#parallelismFixnum (readonly)

the number of threads.

Returns:

  • (Fixnum)

    the current value of parallelism



13
14
15
# File 'lib/ndd/url_checker/threaded_url_checker.rb', line 13

def parallelism
  @parallelism
end

Instance Method Details

#check(*urls) ⇒ NDD::UrlChecker::Status+

Checks that the given URLs are valid.

Parameters:

  • urls (String, Array<String>)

    the URLs to check

Returns:



31
32
33
34
# File 'lib/ndd/url_checker/threaded_url_checker.rb', line 31

def check(*urls)
  # delegate.check(*urls)
  raise 'TODO'
end