End of Life Ruby 3.0 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.0.5/lib/rubygems/gemcutter_utilities.rb, line 200
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
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.