Skip to content

Commit

Permalink
[ruby/uri] String literals are frozen now
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and matzbot committed Jun 25, 2023
1 parent c21436c commit 8307627
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lib/uri/rfc3986_parser.rb
Expand Up @@ -83,9 +83,9 @@ def split(uri) #:nodoc:
uri.ascii_only? or
raise InvalidURIError, "URI must be ascii only #{uri.dump}"
if m = RFC3986_URI.match(uri)
query = m["query".freeze]
scheme = m["scheme".freeze]
opaque = m["path-rootless".freeze]
query = m["query"]
scheme = m["scheme"]
opaque = m["path-rootless"]
if opaque
opaque << "?#{query}" if query
[ scheme,
Expand All @@ -96,35 +96,35 @@ def split(uri) #:nodoc:
nil, # path
opaque,
nil, # query
m["fragment".freeze]
m["fragment"]
]
else # normal
[ scheme,
m["userinfo".freeze],
m["host".freeze],
m["port".freeze],
m["userinfo"],
m["host"],
m["port"],
nil, # registry
(m["path-abempty".freeze] ||
m["path-absolute".freeze] ||
m["path-empty".freeze]),
(m["path-abempty"] ||
m["path-absolute"] ||
m["path-empty"]),
nil, # opaque
query,
m["fragment".freeze]
m["fragment"]
]
end
elsif m = RFC3986_relative_ref.match(uri)
[ nil, # scheme
m["userinfo".freeze],
m["host".freeze],
m["port".freeze],
m["userinfo"],
m["host"],
m["port"],
nil, # registry,
(m["path-abempty".freeze] ||
m["path-absolute".freeze] ||
m["path-noscheme".freeze] ||
m["path-empty".freeze]),
(m["path-abempty"] ||
m["path-absolute"] ||
m["path-noscheme"] ||
m["path-empty"]),
nil, # opaque
m["query".freeze],
m["fragment".freeze]
m["query"],
m["fragment"]
]
else
raise InvalidURIError, "bad URI(is not URI?): #{uri.inspect}"
Expand Down

0 comments on commit 8307627

Please sign in to comment.