class Addressable::URI
def authority=(new_authority)
-
new_authority
(String, #to_str
) -- The new authority component.
def authority=(new_authority) if new_authority if !new_authority.respond_to?(:to_str) raise TypeError, "Can't convert #{new_authority.class} into String." end new_authority = new_authority.to_str new_userinfo = new_authority[/^([^\[\]]*)@/, 1] if new_userinfo new_user = new_userinfo.strip[/^([^:]*):?/, 1] new_password = new_userinfo.strip[/:(.*)$/, 1] end new_host = new_authority.gsub(/^([^\[\]]*)@/, EMPTYSTR).gsub(/:([^:@\[\]]*?)$/, EMPTYSTR) new_port = new_authority[/:([^:@\[\]]*?)$/, 1] end # Password assigned first to ensure validity in case of nil self.password = defined?(new_password) ? new_password : nil self.user = defined?(new_user) ? new_user : nil self.host = defined?(new_host) ? new_host : nil self.port = defined?(new_port) ? new_port : nil # Reset dependant values @userinfo = nil @normalized_userinfo = nil @uri_string = nil @hash = nil # Ensure we haven't created an invalid URI validate() end