# File lib/webmock/stub_registry.rb, line 20
    def register_global_stub(&block)
      # This hash contains the responses returned by the block,
      # keyed by the exact request (using the object_id).
      # That way, there's no race condition in case #to_return
      # doesn't run immediately after stub.with.
      responses = {}

      stub = ::WebMock::RequestStub.new(:any, /.*/).with { |request|
        responses[request.object_id] = block.call(request)
      }.to_return(lambda { |request| responses.delete(request.object_id) })

      global_stubs.push stub
    end