Sha256: c7662fbe06dd8ff27ca9a262821399ca172aa8a522e8c6be4281b4de675339df

Contents?: true

Size: 815 Bytes

Versions: 105

Compression:

Stored size: 815 Bytes

Contents

module WebMock
  class CallbackRegistry
    @@callbacks = []

    def self.add_callback(options, block)
      @@callbacks << {options: options, block: block}
    end

    def self.callbacks
      @@callbacks
    end

    def self.invoke_callbacks(options, request_signature, response)
      return if @@callbacks.empty?
      CallbackRegistry.callbacks.each do |callback|
        except = callback[:options][:except]
        real_only = callback[:options][:real_requests_only]
        unless except && except.include?(options[:lib])
          if !real_only || options[:real_request]
            callback[:block].call(request_signature, response)
          end
        end
      end
    end

    def self.reset
      @@callbacks = []
    end

    def self.any_callbacks?
      !@@callbacks.empty?
    end

  end
end

Version data entries

105 entries across 99 versions & 8 rubygems

Version Path
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/webmock-2.3.2/lib/webmock/callback_registry.rb
webmock-2.3.2 lib/webmock/callback_registry.rb
webmock-2.3.1 lib/webmock/callback_registry.rb
webmock-2.2.0 lib/webmock/callback_registry.rb
webmock-2.1.0 lib/webmock/callback_registry.rb