Class: NDD::UrlChecker::BlockingUrlChecker
- Inherits:
-
AbstractUrlChecker
- Object
- AbstractUrlChecker
- NDD::UrlChecker::BlockingUrlChecker
- Defined in:
- lib/ndd/url_checker/blocking_url_checker.rb
Overview
An URL checker using the blocking Net::HTTP class.
Instance Method Summary collapse
-
#check(*urls) ⇒ NDD::UrlChecker::Status+
Checks that the given URLs are valid.
-
#initialize(maximum_redirects: 5, timeout: 5) ⇒ BlockingUrlChecker
constructor
Create a new instance.
Constructor Details
#initialize(maximum_redirects: 5, timeout: 5) ⇒ BlockingUrlChecker
Create a new instance.
17 18 19 20 21 |
# File 'lib/ndd/url_checker/blocking_url_checker.rb', line 17 def initialize(maximum_redirects: 5, timeout: 5) @logger = Logging.logger[self] @maximum_redirects = maximum_redirects @timeout = timeout end |
Instance Method Details
#check(*urls) ⇒ NDD::UrlChecker::Status+
Checks that the given URLs are valid.
27 28 29 30 31 |
# File 'lib/ndd/url_checker/blocking_url_checker.rb', line 27 def check(*urls) @logger.debug "Checking #{urls.size} URL(s)" return check_single(urls.first) if urls.size < 2 urls.map { |url| check_single(url) } end |