Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

URI.register_scheme

register_scheme(scheme, klass)

Registers the given klass as the class to be instantiated when parsing a URI with the given scheme:

Example
URI.register_scheme('MS_SEARCH', URI::Generic) # => URI::Generic
URI.scheme_list['MS_SEARCH']                   # => URI::Generic

Note that after calling String#upcase on scheme, it must be a valid constant name.

See also .parser= .scheme_list .parse .split also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1