Sha256: 217ea73adb16562536ed20617b047adafb60dc2bd3b2d13efc891acc158b7b1c

Contents?: true

Size: 793 Bytes

Versions: 6813

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

Version Path
cybrid_api_id_ruby-0.123.124 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_bank_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_id_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_organization_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_bank_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_organization_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_id_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_bank_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_id_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_organization_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_bank_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_organization_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_id_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_bank_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_organization_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_id_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_bank_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_id_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_organization_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb
cybrid_api_bank_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/typhoeus-1.4.1/lib/typhoeus/request/before.rb