[ruby/uri] Fallback missing constants with RFC3986_PARSER

(https://github.com/ruby/uri/pull/113)

* Fallback missing constants with RFC3986_PARSER

* raise missing constant

* Update test/uri/test_common.rb

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

* Update lib/uri/common.rb

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

* Update lib/uri/common.rb

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

---------

c2fdec079a

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
Hiroshi SHIBATA 2024-08-06 17:09:47 +08:00 committed by git
parent 24d46a6781
commit 267da552a1
2 changed files with 18 additions and 0 deletions

View file

@ -45,6 +45,15 @@ module URI
end
self.parser = RFC3986_PARSER
def self.const_missing(const)
if value = RFC2396_PARSER.regexp[const]
warn "URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
value
else
super
end
end
module Util # :nodoc:
def make_components_hash(klass, array_hash)
tmp = {}