Method: Addressable::URI#normalized_userinfo

Defined in:
lib/addressable/uri.rb

#normalized_userinfoString

The userinfo component for this URI, normalized.

Returns:

  • (String)

    The userinfo component, normalized.



1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
# File 'lib/addressable/uri.rb', line 1068

def normalized_userinfo
  return nil unless self.userinfo
  return @normalized_userinfo unless @normalized_userinfo == NONE
  @normalized_userinfo = begin
    current_user = self.normalized_user
    current_password = self.normalized_password
    if !current_user && !current_password
      nil
    elsif current_user && current_password
      "#{current_user}:#{current_password}".dup
    elsif current_user && !current_password
      "#{current_user}".dup
    end
  end
  # All normalized values should be UTF-8
  force_utf8_encoding_if_needed(@normalized_userinfo)
  @normalized_userinfo
end