File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ def self.parser=(parser = RFC3986_PARSER)
4545 end
4646 self . parser = RFC3986_PARSER
4747
48+ def self . const_missing ( const )
49+ if value = RFC2396_PARSER . regexp [ const ]
50+ warn "URI::#{ const } is obsolete. Use RFC2396_PARSER.regexp[#{ const . inspect } ] explicitly." , uplevel : 1 if $VERBOSE
51+ value
52+ else
53+ super
54+ end
55+ end
56+
4857 module Util # :nodoc:
4958 def make_components_hash ( klass , array_hash )
5059 tmp = { }
Original file line number Diff line number Diff line change @@ -10,6 +10,15 @@ def setup
1010 def teardown
1111 end
1212
13+ def test_fallback_constants
14+ orig_verbose = $VERBOSE
15+ $VERBOSE = nil
16+ assert URI ::ABS_URI
17+ assert_raise ( NameError ) { URI ::FOO }
18+ ensure
19+ $VERBOSE = orig_verbose
20+ end
21+
1322 def test_parser_switch
1423 assert_equal ( URI ::Parser , URI ::RFC3986_Parser )
1524 refute defined? ( URI ::REGEXP )
You can’t perform that action at this time.
0 commit comments