Class: LinkChecker::Typhoeus::Hydra::Task

Inherits:
LinkChecker::Task show all
Defined in:
lib/ruby-link-checker/typhoeus/hydra/checker.rb

Instance Attribute Summary

Attributes inherited from LinkChecker::Task

#checker, #logger, #method, #options, #original_uri, #uri

Instance Method Summary collapse

Methods inherited from LinkChecker::Task

#initialize

Methods included from Callbacks

#callbacks, #delegates, #method_missing, #on

Constructor Details

This class inherits a constructor from LinkChecker::Task

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class LinkChecker::Callbacks

Instance Method Details

#run!Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ruby-link-checker/typhoeus/hydra/checker.rb', line 5

def run!
  request = ::Typhoeus::Request.new(
    uri, {
      method: method,
      followlocation: false,
      timeout: checker.timeout,
      connecttimeout: checker.connecttimeout,
      headers: {
        'User-Agent' => checker.user_agent
      }
    }
  )
  request.on_complete do |response|
    if response.timed_out?
      result! ResultError.new(uri, method, original_uri, Timeout::Error.new, options)
    else
      result! Result.new(uri, method, original_uri, request, response, options)
    end
  end
  checker._queue(request)
end