pathname: Remove unneeded constant

`SEPARATOR_LIST` is used only to initialize `SEPARATOR_PAT`.
This commit is contained in:
Nobuyoshi Nakada 2026-05-01 13:39:03 +09:00
parent 0f618b87d5
commit 4e243c709e
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2026-05-08 10:37:24 +00:00

View File

@ -349,16 +349,15 @@ class Pathname
if File::ALT_SEPARATOR
# Separator list string.
SEPARATOR_LIST = Regexp.quote "#{File::ALT_SEPARATOR}#{File::SEPARATOR}"
separator_list = Regexp.quote "#{File::ALT_SEPARATOR}#{File::SEPARATOR}"
# Regexp that matches a separator.
SEPARATOR_PAT = /[#{SEPARATOR_LIST}]/
SEPARATOR_PAT = /[#{separator_list}]/
else
SEPARATOR_LIST = Regexp.quote File::SEPARATOR
SEPARATOR_PAT = /#{SEPARATOR_LIST}/
separator_list = Regexp.quote File::SEPARATOR
SEPARATOR_PAT = /#{separator_list}/
end
SEPARATOR_LIST.freeze
SEPARATOR_PAT.freeze
private_constant :SEPARATOR_LIST, :SEPARATOR_LIST
private_constant :SEPARATOR_PAT
if File.dirname('A:') == 'A:.' # DOSish drive letter
# Regexp that matches an absolute path.