summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2024-11-14 11:58:08 +0900
committergit <[email protected]>2024-11-14 03:32:13 +0000
commit310e6603a27bcfd8e505756150e4e5d7f1e20611 (patch)
tree0bc5ab9c139e7eef209cb9d0e0455a05cc684a83
parent44fb1de9e9c791375c11984e69d65367526eb80a (diff)
[ruby/uri] Check existence constants only URI module
https://github.com/ruby/uri/commit/b6f583369a
-rw-r--r--lib/uri/common.rb2
-rw-r--r--lib/uri/rfc2396_parser.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/uri/common.rb b/lib/uri/common.rb
index 576b407de9..ee8ffae5c9 100644
--- a/lib/uri/common.rb
+++ b/lib/uri/common.rb
@@ -34,7 +34,7 @@ module URI
end
Parser.new.regexp.each_pair do |sym, str|
- remove_const(sym) if const_defined?(sym)
+ remove_const(sym) if const_defined?(sym, false)
const_set(sym, str)
end
end
diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb
index c112b1b368..0336366b36 100644
--- a/lib/uri/rfc2396_parser.rb
+++ b/lib/uri/rfc2396_parser.rb
@@ -539,7 +539,7 @@ module URI
# Backward compatibility for URI::REGEXP::PATTERN::*
RFC2396_Parser.new.pattern.each_pair do |sym, str|
- unless RFC2396_REGEXP::PATTERN.const_defined?(sym)
+ unless RFC2396_REGEXP::PATTERN.const_defined?(sym, false)
RFC2396_REGEXP::PATTERN.const_set(sym, str)
end
end