/usr/lib/ruby/vendor_ruby/typhoeus/hydra/before.rb is in ruby-typhoeus 0.6.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | module Typhoeus
class Hydra
# This module provides a way to hook into before
# a request gets queued in hydra. This is very powerful
# and you should be careful because when you accidently
# return a falsy value the request won't be executed.
#
# @api private
module Before
# Overrride add in order to execute callbacks in
# Typhoeus.before. Will break and return when a
# callback returns nil or false. Calls super
# otherwise.
#
# @example Add the request.
# hydra.add(request)
def add(request)
Typhoeus.before.each do |callback|
value = callback.call(request)
if value.nil? || value == false || value.is_a?(Response)
return value
end
end
super
end
end
end
end
|