From b6f583369a2c0f31a8aeff488d1e9c0bf05edac6 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 14 Nov 2024 11:58:08 +0900 Subject: [PATCH] Check existence constants only URI module --- lib/uri/common.rb | 2 +- lib/uri/rfc2396_parser.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index f13ff1a..c3fe0b4 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -34,7 +34,7 @@ def self.parser=(parser = RFC3986_PARSER) 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 c112b1b..0336366 100644 --- a/lib/uri/rfc2396_parser.rb +++ b/lib/uri/rfc2396_parser.rb @@ -539,7 +539,7 @@ def convert_to_uri(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