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