@@ -312,12 +312,12 @@ def sub_ext(repl)
312312
313313 if File ::ALT_SEPARATOR
314314 # Separator list string.
315- SEPARATOR_LIST = " #{ Regexp . quote File ::ALT_SEPARATOR } #{ Regexp . quote File ::SEPARATOR } "
315+ SEPARATOR_LIST = Regexp . quote " #{ File ::ALT_SEPARATOR } #{ File ::SEPARATOR } "
316316 # Regexp that matches a separator.
317317 SEPARATOR_PAT = /[#{ SEPARATOR_LIST } ]/
318318 else
319- SEPARATOR_LIST = " #{ Regexp . quote File ::SEPARATOR } "
320- SEPARATOR_PAT = /#{ Regexp . quote File :: SEPARATOR } /
319+ SEPARATOR_LIST = Regexp . quote File ::SEPARATOR
320+ SEPARATOR_PAT = /#{ SEPARATOR_LIST } /
321321 end
322322
323323 if File . dirname ( 'A:' ) == 'A:.' # DOSish drive letter
@@ -383,7 +383,7 @@ def split_names(path) # :nodoc:
383383 def prepend_prefix ( prefix , relpath ) # :nodoc:
384384 if relpath . empty?
385385 File . dirname ( prefix )
386- elsif / #{ SEPARATOR_PAT } /o . match? ( prefix )
386+ elsif SEPARATOR_PAT . match? ( prefix )
387387 prefix = File . dirname ( prefix )
388388 prefix = File . join ( prefix , "" ) if File . basename ( prefix + 'a' ) != 'a'
389389 prefix + relpath
@@ -434,7 +434,7 @@ def cleanpath_aggressive # :nodoc:
434434 end
435435 end
436436 pre . tr! ( File ::ALT_SEPARATOR , File ::SEPARATOR ) if File ::ALT_SEPARATOR
437- if / #{ SEPARATOR_PAT } /o . match? ( File . basename ( pre ) )
437+ if SEPARATOR_PAT . match? ( File . basename ( pre ) )
438438 names . shift while names [ 0 ] == '..'
439439 end
440440 self . class . new ( prepend_prefix ( pre , File . join ( *names ) ) )
@@ -483,7 +483,7 @@ def cleanpath_conservative # :nodoc:
483483 names . unshift base if base != '.'
484484 end
485485 pre . tr! ( File ::ALT_SEPARATOR , File ::SEPARATOR ) if File ::ALT_SEPARATOR
486- if / #{ SEPARATOR_PAT } /o . match? ( File . basename ( pre ) )
486+ if SEPARATOR_PAT . match? ( File . basename ( pre ) )
487487 names . shift while names [ 0 ] == '..'
488488 end
489489 if names . empty?
@@ -528,7 +528,7 @@ def mountpoint?
528528 # pathnames which points to roots such as <tt>/usr/..</tt>.
529529 #
530530 def root?
531- chop_basename ( @path ) == nil && / #{ SEPARATOR_PAT } /o . match? ( @path )
531+ chop_basename ( @path ) == nil && SEPARATOR_PAT . match? ( @path )
532532 end
533533
534534 # Predicate method for testing whether a path is absolute.
@@ -698,7 +698,7 @@ def plus(path1, path2) # -> path # :nodoc:
698698 basename_list2 . shift
699699 end
700700 r1 = chop_basename ( prefix1 )
701- if !r1 && ( r1 = / #{ SEPARATOR_PAT } /o . match? ( File . basename ( prefix1 ) ) )
701+ if !r1 && ( r1 = SEPARATOR_PAT . match? ( File . basename ( prefix1 ) ) )
702702 while !basename_list2 . empty? && basename_list2 . first == '..'
703703 index_list2 . shift
704704 basename_list2 . shift
0 commit comments