Skip to content

Commit

Permalink
Merge pull request #135 from ruby/fix-host-constants
Browse files Browse the repository at this point in the history
Check existence constants only URI module
  • Loading branch information
hsbt authored Nov 14, 2024
2 parents eafc475 + b6f5833 commit b45aabb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/uri/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/uri/rfc2396_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b45aabb

Please sign in to comment.