class Addressable::URI

def initialize(options={})

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

def initialize: (?Hash options) -> void

This signature was generated using 4 samples from 2 applications.

Returns:
  • (Addressable::URI) - The constructed URI object.

Options Hash: (**[String,)
  • #to_str (]) -- to_str] fragment The fragment component.
  • #to_str (]) -- to_str] query The query component.
  • #to_str (]) -- to_str] path The path component.
  • #to_str (]) -- to_str] authority
  • #to_str (]) -- to_str] port The port component.
  • #to_str (]) -- to_str] host The host component.
  • #to_str (]) -- to_str] userinfo
  • #to_str (]) -- to_str] password The password component.
  • #to_str (]) -- to_str] user The user component.
  • #to_str (]) -- to_str] scheme The scheme component.
def initialize(options={})
  if options.has_key?(:authority)
    if (options.keys & [:userinfo, :user, :password, :host, :port]).any?
      raise ArgumentError,
        "Cannot specify both an authority and any of the components " +
        "within the authority."
    end
  end
  if options.has_key?(:userinfo)
    if (options.keys & [:user, :password]).any?
      raise ArgumentError,
        "Cannot specify both a userinfo and either the user or password."
    end
  end
  reset_ivs
  defer_validation do
    # Bunch of crazy logic required because of the composite components
    # like userinfo and authority.
    self.scheme = options[:scheme] if options[:scheme]
    self.user = options[:user] if options[:user]
    self.password = options[:password] if options[:password]
    self.userinfo = options[:userinfo] if options[:userinfo]
    self.host = options[:host] if options[:host]
    self.port = options[:port] if options[:port]
    self.authority = options[:authority] if options[:authority]
    self.path = options[:path] if options[:path]
    self.query = options[:query] if options[:query]
    self.query_values = options[:query_values] if options[:query_values]
    self.fragment = options[:fragment] if options[:fragment]
  end
  to_s # force path validation
end