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)
4646 self . parser = RFC3986_PARSER
4747
4848 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 ]
5053 warn "URI::#{ const } is obsolete. Use RFC2396_PARSER.regexp[#{ const . inspect } ] explicitly." , uplevel : 1 if $VERBOSE
5154 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
5258 else
5359 super
5460 end
Original file line number Diff line number Diff line change @@ -13,8 +13,12 @@ def teardown
1313 def test_fallback_constants
1414 orig_verbose = $VERBOSE
1515 $VERBOSE = nil
16- assert URI :: ABS_URI
16+
1717 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
1822 ensure
1923 $VERBOSE = orig_verbose
2024 end
You can’t perform that action at this time.
0 commit comments