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
ory-client-0.0.1.alpha55 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha54 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha53 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha52 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha51 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha50 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha49 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha48 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha47 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha46 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha45 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha44 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha43 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha42 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha41 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha40 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha39 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha38 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha37 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
ory-client-0.0.1.alpha36 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb