Skip to content

Commit

Permalink
Use a fully qualified name in warning messages
Browse files Browse the repository at this point in the history
Currently, some warning messages don't contain a `URI` like the following.

```ruby
warning: URI::ABS_URI is obsolete. Use RFC2396_PARSER.regexp[:ABS_URI] explicitly.
```

But, without `URI` prefix, the suggested value doesn't work.
So I think we should use a fully qualified name to avoid confusion.
  • Loading branch information
y-yagi committed Feb 2, 2025
1 parent ddabff4 commit 428eb10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/uri/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def self.const_missing(const) # :nodoc:
warn "URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
URI::RFC2396_REGEXP
elsif value = RFC2396_PARSER.regexp[const]
warn "URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
warn "URI::#{const} is obsolete. Use URI::RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
value
elsif value = RFC2396_Parser.const_get(const)
warn "URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
warn "URI::#{const} is obsolete. Use URI::RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
value
else
super
Expand Down

0 comments on commit 428eb10

Please sign in to comment.