From 4e243c709e45eb0d115b7875cae25dff86184b59 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 1 May 2026 13:39:03 +0900 Subject: pathname: Remove unneeded constant `SEPARATOR_LIST` is used only to initialize `SEPARATOR_PAT`. --- pathname_builtin.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pathname_builtin.rb b/pathname_builtin.rb index 60f936632f..d3da315872 100644 --- a/pathname_builtin.rb +++ b/pathname_builtin.rb @@ -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. -- cgit v1.2.3