File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,15 @@ def self.parser=(parser = RFC3986_PARSER)
46
46
self . parser = RFC3986_PARSER
47
47
48
48
def self . const_missing ( const )
49
- if value = RFC2396_PARSER . regexp [ const ]
49
+ if const == :REGEXP
50
+ warn "URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly." , uplevel : 1 if $VERBOSE
51
+ URI ::RFC2396_REGEXP
52
+ elsif value = RFC2396_PARSER . regexp [ const ]
50
53
warn "URI::#{ const } is obsolete. Use RFC2396_PARSER.regexp[#{ const . inspect } ] explicitly." , uplevel : 1 if $VERBOSE
51
54
value
55
+ elsif value = RFC2396_Parser . const_get ( const )
56
+ warn "URI::#{ const } is obsolete. Use RFC2396_Parser::#{ const } explicitly." , uplevel : 1 if $VERBOSE
57
+ value
52
58
else
53
59
super
54
60
end
Original file line number Diff line number Diff line change @@ -13,8 +13,12 @@ def teardown
13
13
def test_fallback_constants
14
14
orig_verbose = $VERBOSE
15
15
$VERBOSE = nil
16
- assert URI :: ABS_URI
16
+
17
17
assert_raise ( NameError ) { URI ::FOO }
18
+
19
+ assert_equal URI ::ABS_URI , URI ::RFC2396_PARSER . regexp [ :ABS_URI ]
20
+ assert_equal URI ::PATTERN , URI ::RFC2396_Parser ::PATTERN
21
+ assert_equal URI ::REGEXP , URI ::RFC2396_REGEXP
18
22
ensure
19
23
$VERBOSE = orig_verbose
20
24
end
You can’t perform that action at this time.
0 commit comments