Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

URI::Generic.new

(::String? scheme, ::String? userinfo, ::String? host, (::String | ::Integer)? port, nil registry, ::String? path, ::String? opaque, ::String? query, ::String? fragment, ?untyped parser, ?::boolish arg_check) -> ::URI::Generic
new(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = DEFAULT_PARSER, arg_check = false)

Args

scheme

Protocol scheme, i.e. ‘http’,‘ftp’,‘mailto’ and so on.

userinfo

User name and password, i.e. ‘sdmitry:bla’.

host

Server host name.

port

Server port.

registry

Registry of naming authorities.

path

Path on server.

opaque

Opaque part.

query

Query data.

fragment

Part of the URI after ‘#’ character.

parser

Parser for internal use [URI::DEFAULT_PARSER by default].

arg_check

Check arguments [false by default].

Description

Creates a new URI::Generic instance from “generic” components without check.

See also .default_port #+ .component #- also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0