Skip to content

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

instance method

URI::Generic#hierarchical?

hierarchical?

Returns true if URI is hierarchical.

Description

URI has components listed in order of decreasing significance from left to right, see RFC3986 tools.ietf.org/html/rfc3986 1.2.3.

Usage

Example
require 'uri'

uri = URI.parse("http://my.example.com/")
uri.hierarchical?
#=> true
uri = URI.parse("mailto:[email protected]")
uri.hierarchical?
#=> false
See also #hash #host= #fragment= #hostname also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0