Sha256: 217ea73adb16562536ed20617b047adafb60dc2bd3b2d13efc891acc158b7b1c

Contents?: true

Size: 793 Bytes

Versions: 6858

Compression:

Stored size: 793 Bytes

Contents

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

Version data entries

6,858 entries across 6,855 versions & 28 rubygems

Version Path
ory-kratos-client-0.8.2.alpha1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha31 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha30 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha29 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha28 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha27 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha24 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha23 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-kratos-client-0.8.0.alpha2 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha21 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-keto-client-0.7.0.alpha1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-keto-client-0.7.0.alpha0 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-kratos-client-0.7.6.alpha7 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-kratos-client-0.7.6.alpha6 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-kratos-client-0.7.6.alpha5 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-kratos-client-0.7.6.alpha4 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-kratos-client-0.7.6.alpha3 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-kratos-client-0.7.6.alpha1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-kratos-client-0.7.5.alpha2 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
cloudsmith-api-0.57.1 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb