Skip to content

Commit 4e243c7

Browse files
committed
pathname: Remove unneeded constant
`SEPARATOR_LIST` is used only to initialize `SEPARATOR_PAT`.
1 parent 0f618b8 commit 4e243c7

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

pathname_builtin.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,16 +349,15 @@ def sub_ext(repl)
349349

350350
if File::ALT_SEPARATOR
351351
# Separator list string.
352-
SEPARATOR_LIST = Regexp.quote "#{File::ALT_SEPARATOR}#{File::SEPARATOR}"
352+
separator_list = Regexp.quote "#{File::ALT_SEPARATOR}#{File::SEPARATOR}"
353353
# Regexp that matches a separator.
354-
SEPARATOR_PAT = /[#{SEPARATOR_LIST}]/
354+
SEPARATOR_PAT = /[#{separator_list}]/
355355
else
356-
SEPARATOR_LIST = Regexp.quote File::SEPARATOR
357-
SEPARATOR_PAT = /#{SEPARATOR_LIST}/
356+
separator_list = Regexp.quote File::SEPARATOR
357+
SEPARATOR_PAT = /#{separator_list}/
358358
end
359-
SEPARATOR_LIST.freeze
360359
SEPARATOR_PAT.freeze
361-
private_constant :SEPARATOR_LIST, :SEPARATOR_LIST
360+
private_constant :SEPARATOR_PAT
362361

363362
if File.dirname('A:') == 'A:.' # DOSish drive letter
364363
# Regexp that matches an absolute path.

0 commit comments

Comments
 (0)