Sha256: c73d3dcab2bc4836bea5f9bcea04a55dc10224489ab54f9eca7512cb73f15ffa

Contents?: true

Size: 855 Bytes

Versions: 6916

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,916 entries across 6,913 versions & 28 rubygems

Version Path
ory-client-1.16.6 vendor/bundle/ruby/3.1.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.214 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.214 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.214 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.213 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.213 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.213 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.212 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.212 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.212 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.211 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.211 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.211 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.208 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.208 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.208 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.207 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.207 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.207 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.206 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb