extract Faraday::Connection#url_prefix= logic

This commit is contained in:
rick 2009-12-21 12:06:22 -08:00
parent a85ab797bb
commit fd7dfdac66

View File

@ -17,13 +17,15 @@ module Faraday
def initialize(url = nil)
@response_class = nil
if url
uri = URI.parse(url)
self.scheme = uri.scheme
self.host = uri.host
self.port = uri.port
self.path_prefix = uri.path
end
self.url_prefix = url if url
end
def url_prefix=(url)
uri = URI.parse(url)
self.scheme = uri.scheme
self.host = uri.host
self.port = uri.port
self.path_prefix = uri.path
end
# Override in a subclass, or include an adapter