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
typhoeus-1.0.0 lib/typhoeus/request/before.rb
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/typhoeus-0.8.0/lib/typhoeus/request/before.rb
typhoeus-0.8.0 lib/typhoeus/request/before.rb
typhoeus-0.7.3 lib/typhoeus/request/before.rb
typhoeus-0.7.2 lib/typhoeus/request/before.rb
typhoeus-0.7.1 lib/typhoeus/request/before.rb
typhoeus-0.7.0 lib/typhoeus/request/before.rb
typhoeus-0.7.0.pre1 lib/typhoeus/request/before.rb
typhoeus-0.6.9 lib/typhoeus/request/before.rb
typhoeus-0.6.8 lib/typhoeus/request/before.rb
typhoeus-0.6.7 lib/typhoeus/request/before.rb
typhoeus-0.6.6 lib/typhoeus/request/before.rb
typhoeus-0.6.5 lib/typhoeus/request/before.rb
typhoeus-0.6.4 lib/typhoeus/request/before.rb
typhoeus-0.6.3 lib/typhoeus/request/before.rb
typhoeus-0.6.2 lib/typhoeus/request/before.rb
typhoeus-0.6.1 lib/typhoeus/request/before.rb
typhoeus-0.6.0 lib/typhoeus/request/before.rb