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)
45
45
end
46
46
self . parser = RFC3986_PARSER
47
47
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
+
48
57
module Util # :nodoc:
49
58
def make_components_hash ( klass , array_hash )
50
59
tmp = { }
Original file line number Diff line number Diff line change @@ -10,6 +10,15 @@ def setup
10
10
def teardown
11
11
end
12
12
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
+
13
22
def test_parser_switch
14
23
assert_equal ( URI ::Parser , URI ::RFC3986_Parser )
15
24
refute defined? ( URI ::REGEXP )
You can’t perform that action at this time.
0 commit comments