Sha256: c73d3dcab2bc4836bea5f9bcea04a55dc10224489ab54f9eca7512cb73f15ffa

Contents?: true

Size: 855 Bytes

Versions: 6854

Compression:

Stored size: 855 Bytes

Contents

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, false or a response. 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)
            dequeue
            return value
          end
        end
        super
      end
    end
  end
end

Version data entries

6,854 entries across 6,851 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/hydra/before.rb
ory-client-0.0.1.alpha31 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-client-0.0.1.alpha30 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-client-0.0.1.alpha29 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-client-0.0.1.alpha28 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-client-0.0.1.alpha27 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-client-0.0.1.alpha24 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-client-0.0.1.alpha23 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-kratos-client-0.8.0.alpha2 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-client-0.0.1.alpha21 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-keto-client-0.7.0.alpha1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-keto-client-0.7.0.alpha0 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-kratos-client-0.7.6.alpha7 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-kratos-client-0.7.6.alpha6 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-kratos-client-0.7.6.alpha5 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-kratos-client-0.7.6.alpha4 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-kratos-client-0.7.6.alpha3 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-kratos-client-0.7.6.alpha1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
ory-kratos-client-0.7.5.alpha2 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
cloudsmith-api-0.57.1 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb