Class: NDD::UrlChecker::ThreadedUrlChecker
- Inherits:
-
AbstractUrlChecker
- Object
- AbstractUrlChecker
- NDD::UrlChecker::ThreadedUrlChecker
- Defined in:
- lib/ndd/url_checker/threaded_url_checker.rb
Overview
An URL checker using threads to parallelize processing. Does not work on MRI.
Instance Attribute Summary collapse
-
#delegate ⇒ #check
readonly
the delegate URL checker.
-
#parallelism ⇒ Fixnum
readonly
the number of threads.
Instance Method Summary collapse
-
#check(*urls) ⇒ NDD::UrlChecker::Status+
Checks that the given URLs are valid.
-
#initialize(delegate_checker: nil, parallelism: 10) ⇒ ThreadedUrlChecker
constructor
Create a new instance.
Constructor Details
#initialize(delegate_checker: nil, parallelism: 10) ⇒ ThreadedUrlChecker
Create a new instance.
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.
13 14 15 |
# File 'lib/ndd/url_checker/threaded_url_checker.rb', line 13 def delegate @delegate end |
#parallelism ⇒ Fixnum (readonly)
the number of threads.
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.
31 32 33 34 |
# File 'lib/ndd/url_checker/threaded_url_checker.rb', line 31 def check(*urls) # delegate.check(*urls) raise 'TODO' end |