You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: net_http.rb
    path of file: ./repos/semian/lib/semian
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require "semian/adapter"
require "net/http"

module Net
  ProtocolError.include(::Semian::AdapterE
    
    def with_resource_timeout(timeout)
      prev_read_timeout = read_timeout
      prev_open_timeout = open_timeout
      begin
        self.read_timeout = timeout
        self.open_timeout = timeout
        yield
      ensure
        self.read_timeout = prev_read_timeout
        self.open_timeout = prev_open_timeout
      end