Method: Addressable::URI#authority

Defined in:
lib/addressable/uri.rb

#authorityString

The authority component for this URI. Combines the user, password, host, and port components.

Returns:

  • (String)

    The authority component.



1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
# File 'lib/addressable/uri.rb', line 1234

def authority
  self.host && @authority ||= begin
    authority = String.new
    if self.userinfo != nil
      authority << "#{self.userinfo}@"
    end
    authority << self.host
    if self.port != nil
      authority << ":#{self.port}"
    end
    authority
  end
end