Method: JSONSchemer::Format.parse_uri_scheme

Defined in:
lib/json_schemer/format.rb

.parse_uri_scheme(data) ⇒ Object

Raises:

  • (::URI::InvalidURIError)


112
113
114
115
116
117
# File 'lib/json_schemer/format.rb', line 112

def parse_uri_scheme(data)
  scheme, _userinfo, _host, _port, _registry, _path, opaque, query, _fragment = ::URI::RFC3986_PARSER.split(data)
  # ::URI::RFC3986_PARSER.parse allows spaces in these and I don't think it should
  raise ::URI::InvalidURIError if INVALID_QUERY_REGEX.match?(query) || INVALID_QUERY_REGEX.match?(opaque)
  scheme
end