/usr/lib/ruby/vendor_ruby/typhoeus/request/before.rb is in ruby-typhoeus 0.6.8-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 Request
# This module provides a way to hook into before
# a request runs. 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 run in order to execute callbacks in
# Typhoeus.before. Will break and return when a
# callback returns nil or false. Calls super
# otherwise.
#
# @example Run the request.
# request.run
def run
Typhoeus.before.each do |callback|
value = callback.call(self)
if value.nil? || value == false || value.is_a?(Response)
return response
end
end
super
end
end
end
end
|