End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Net::HTTP#start
start() { |http| ... }
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/net/http.rb, line 1233
def start # :yield: http
raise IOError, 'HTTP session already opened' if @started
if block_given?
begin
do_start
return yield(self)
ensure
do_finish
end
end
do_start
self
end
Opens a TCP connection and HTTP session.
When this method is called with a block, it passes the Net::HTTP object to the block, and closes the TCP connection and HTTP session after the block has been executed.
When called with a block, it returns the return value of the block; otherwise, it returns self.