Sha256: a7047dbbd56ab72424a90ee9659cbaf4c79caac2ed5a3d39c8a947b606ae8cb6

Contents?: true

Size: 552 Bytes

Versions: 23

Compression:

Stored size: 552 Bytes

Contents

module Typhoeus
  class Hydra
    module Callbacks
      def self.extended(base)
        class << base
          attr_accessor :global_hooks
        end
        base.global_hooks = Hash.new { |h, k| h[k] = [] }
      end

      def after_request_before_on_complete(&block)
        global_hooks[:after_request_before_on_complete] << block
      end

      def run_global_hooks_for(name, request)
        global_hooks[name].each { |hook| hook.call(request) }
      end

      def clear_global_hooks
        global_hooks.clear
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 6 rubygems

Version Path
dcu-typhoeus-0.4.3 lib/typhoeus/hydra/callbacks.rb
dcu-typhoeus-0.4.2 lib/typhoeus/hydra/callbacks.rb
hhry-typhoeus-0.4.0 lib/typhoeus/hydra/callbacks.rb
typhoeus-0.4.2 lib/typhoeus/hydra/callbacks.rb
typhoeus-0.4.1 lib/typhoeus/hydra/callbacks.rb
typhoeus-0.4.0 lib/typhoeus/hydra/callbacks.rb
dcu-typhoeus-0.4.1 lib/typhoeus/hydra/callbacks.rb
dcu-typhoeus-0.4.0 lib/typhoeus/hydra/callbacks.rb
marnen-typhoeus-0.3.7 lib/typhoeus/hydra/callbacks.rb
marnen-typhoeus-0.3.6 lib/typhoeus/hydra/callbacks.rb
marnen-typhoeus-0.3.5 lib/typhoeus/hydra/callbacks.rb
marnen-typhoeus-0.3.4 lib/typhoeus/hydra/callbacks.rb
typhoeus-0.3.3 lib/typhoeus/hydra/callbacks.rb
typhoeus-0.3.2 lib/typhoeus/hydra/callbacks.rb
xenda-typhoeus-0.2.4 lib/typhoeus/hydra/callbacks.rb
typhoeus-0.2.4 lib/typhoeus/hydra/callbacks.rb
typhoeus-0.2.3 lib/typhoeus/hydra/callbacks.rb
arachni-typhoeus-0.2.0.2 lib/typhoeus/hydra/callbacks.rb
typhoeus-0.2.2 lib/typhoeus/hydra/callbacks.rb
arachni-typhoeus-0.2.0.1 lib/typhoeus/hydra/callbacks.rb