End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::GemcutterUtilities#with_response
with_response(response, error_prefix = nil) { |response| ... }
lib/rubygems/gemcutter_utilities.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/rubygems/gemcutter_utilities.rb, line 207
def with_response(response, error_prefix = nil)
case response
when Net::HTTPSuccess then
if block_given?
yield response
else
say clean_text(response.body)
end
when Net::HTTPPermanentRedirect, Net::HTTPRedirection then
message = "The request has redirected permanently to #{response['location']}. Please check your defined push host URL."
message = "#{error_prefix}: #{message}" if error_prefix
say clean_text(message)
terminate_interaction(ERROR_CODE)
else
message = response.body
message = "#{error_prefix}: #{message}" if error_prefix
say clean_text(message)
terminate_interaction(ERROR_CODE)
end
end
If response is an HTTP Success (2XX) response, yields the response if a block was given or shows the response body to the user.
If the response was not successful, shows an error to the user including the error_prefix and the response body. If the response was a permanent redirect, shows an error to the user including the redirect location.