Class: Html::Test::UrlChecker
- Inherits:
-
Object
- Object
- Html::Test::UrlChecker
- Includes:
- UrlSelector
- Defined in:
- lib/url_checker.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #check_redirects_resolve ⇒ Object
- #check_urls_resolve ⇒ Object
-
#initialize(controller) ⇒ UrlChecker
constructor
A new instance of UrlChecker.
Methods included from UrlSelector
#anchor_urls, #external_http?, #form_urls, #has_protocol?, #http_protocol?, #image_urls, #response_body, #select, #skip_url?, #special_url?, #unsupported_protocol?
Constructor Details
#initialize(controller) ⇒ UrlChecker
Returns a new instance of UrlChecker.
10 11 12 13 14 |
# File 'lib/url_checker.rb', line 10 def initialize(controller) self.request = controller.request self.response = controller.response self.params = controller.params end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
6 7 8 |
# File 'lib/url_checker.rb', line 6 def params @params end |
#request ⇒ Object
Returns the value of attribute request.
6 7 8 |
# File 'lib/url_checker.rb', line 6 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
6 7 8 |
# File 'lib/url_checker.rb', line 6 def response @response end |
Instance Method Details
#check_redirects_resolve ⇒ Object
22 23 24 25 26 27 |
# File 'lib/url_checker.rb', line 22 def check_redirects_resolve redirect_url = response.headers['Location'] if response.status =~ /302/ && redirect_url.present? check_url_resolves(redirect_url) end end |
#check_urls_resolve ⇒ Object
16 17 18 19 20 |
# File 'lib/url_checker.rb', line 16 def check_urls_resolve urls_to_check.each do |url| check_url_resolves(url) end end |