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
cloudsmith-api-0.49.98 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
cloudsmith-api-0.49.94 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
cloudsmith-api-0.49.21 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
cloudsmith-api-0.49.15 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
cloudsmith-api-0.49.13 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
cloudsmith-api-0.49.9 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
cloudsmith-api-0.44.4 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.0/lib/typhoeus/request/before.rb
approveapi-1.0.8 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
approveapi-1.0.5 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/before.rb
typhoeus-1.3.1 lib/typhoeus/request/before.rb
cloudsmith-api-0.30.7 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.0/lib/typhoeus/request/before.rb
color_me_shop-1.0.0 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.3.0/lib/typhoeus/request/before.rb
cloudsmith-api-0.21.4 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.0/lib/typhoeus/request/before.rb
typhoeus-1.3.0 lib/typhoeus/request/before.rb
typhoeus-1.1.2 lib/typhoeus/request/before.rb
typhoeus-1.1.1 lib/typhoeus/request/before.rb
typhoeus-1.1.0 lib/typhoeus/request/before.rb
typhoeus-1.0.2 lib/typhoeus/request/before.rb
typhoeus-1.0.1 lib/typhoeus/request/before.rb