Sha256: c73d3dcab2bc4836bea5f9bcea04a55dc10224489ab54f9eca7512cb73f15ffa

Contents?: true

Size: 855 Bytes

Versions: 6809

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,809 entries across 6,806 versions & 27 rubygems

Version Path
cybrid_api_bank_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
ory-client-1.16.2 vendor/bundle/ruby/3.1.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
talon_one-7.0.0 .github/.example/vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_id_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_organization_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
ory-client-1.16.1 vendor/bundle/ruby/3.1.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
ory-client-1.16.0 vendor/bundle/ruby/3.1.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb
cybrid_api_bank_ruby-0.123.143 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/hydra/before.rb