diff --git a/pathname_builtin.rb b/pathname_builtin.rb index 4a0ecb8480..486e49d092 100644 --- a/pathname_builtin.rb +++ b/pathname_builtin.rb @@ -311,7 +311,9 @@ class Pathname end if File::ALT_SEPARATOR + # Separator list string. SEPARATOR_LIST = "#{Regexp.quote File::ALT_SEPARATOR}#{Regexp.quote File::SEPARATOR}" + # Regexp that matches a separator. SEPARATOR_PAT = /[#{SEPARATOR_LIST}]/ else SEPARATOR_LIST = "#{Regexp.quote File::SEPARATOR}" @@ -319,6 +321,7 @@ class Pathname end if File.dirname('A:') == 'A:.' # DOSish drive letter + # Regexp that matches an absoltute path. ABSOLUTE_PATH = /\A(?:[A-Za-z]:|#{SEPARATOR_PAT})/ else ABSOLUTE_PATH = /\A#{SEPARATOR_PAT}/