'Sorbet overrides URI from Kernel
I have method as below
sig do
params(uri: URI).returns(String)
end
def get(uri)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.start
response = http.request_get(uri.path)
response.body
ensure
http&.finish
end
Test method is like below (does not use sorbet)
def test_get_retry
uri = URI('http://localhost:4567')
instance = BookStoreHttpClient.new
begin
instance.get_with_retry(uri)
rescue StandardError
assert(true)
end
end
But Sorbet complains with "Method host does not exist on URI", but it is a Kernel class actually.
Is there a way to tell Sorbet to use Kernel::URI instead of URI in sorbet/rbi/hidden-definitions/hidden.rbi
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
