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