Method: Addressable::URI#normalized_authority

Defined in:
lib/addressable/uri.rb

#normalized_authorityString

The authority component for this URI, normalized.

Returns:

  • (String)

    The authority component, normalized.



1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
# File 'lib/addressable/uri.rb', line 1252

def normalized_authority
  return nil unless self.authority
  @normalized_authority ||= begin
    authority = String.new
    if self.normalized_userinfo != nil
      authority << "#{self.normalized_userinfo}@"
    end
    authority << self.normalized_host
    if self.normalized_port != nil
      authority << ":#{self.normalized_port}"
    end
    authority
  end
  # All normalized values should be UTF-8
  force_utf8_encoding_if_needed(@normalized_authority)
  @normalized_authority
end