class Addressable::URI

def authority=(new_authority)

Experimental RBS support (using type sampling data from the type_fusion project).

def authority=: (String new_authority) -> nil

This signature was generated using 33 samples from 2 applications.

Parameters:
  • 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.sub(
      /^([^\[\]]*)@/, EMPTY_STR
    ).sub(
      /:([^:@\[\]]*?)$/, EMPTY_STR
    )
    new_port =
      new_authority[/:([^:@\[\]]*?)$/, 1]
  end
  # Password assigned first to ensure validity in case of nil
  self.password = new_password
  self.user = new_user
  self.host = new_host
  self.port = new_port
  # Reset dependent values
  @userinfo = nil
  @normalized_userinfo = NONE
  remove_composite_values
  # Ensure we haven't created an invalid URI
  validate()
end