@@ -312,12 +312,12 @@ def sub_ext(repl)
312
312
313
313
if File ::ALT_SEPARATOR
314
314
# 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 } "
316
316
# Regexp that matches a separator.
317
317
SEPARATOR_PAT = /[#{ SEPARATOR_LIST } ]/
318
318
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 } /
321
321
end
322
322
323
323
if File . dirname ( 'A:' ) == 'A:.' # DOSish drive letter
@@ -383,7 +383,7 @@ def split_names(path) # :nodoc:
383
383
def prepend_prefix ( prefix , relpath ) # :nodoc:
384
384
if relpath . empty?
385
385
File . dirname ( prefix )
386
- elsif / #{ SEPARATOR_PAT } /o . match? ( prefix )
386
+ elsif SEPARATOR_PAT . match? ( prefix )
387
387
prefix = File . dirname ( prefix )
388
388
prefix = File . join ( prefix , "" ) if File . basename ( prefix + 'a' ) != 'a'
389
389
prefix + relpath
@@ -434,7 +434,7 @@ def cleanpath_aggressive # :nodoc:
434
434
end
435
435
end
436
436
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 ) )
438
438
names . shift while names [ 0 ] == '..'
439
439
end
440
440
self . class . new ( prepend_prefix ( pre , File . join ( *names ) ) )
@@ -483,7 +483,7 @@ def cleanpath_conservative # :nodoc:
483
483
names . unshift base if base != '.'
484
484
end
485
485
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 ) )
487
487
names . shift while names [ 0 ] == '..'
488
488
end
489
489
if names . empty?
@@ -528,7 +528,7 @@ def mountpoint?
528
528
# pathnames which points to roots such as <tt>/usr/..</tt>.
529
529
#
530
530
def root?
531
- chop_basename ( @path ) == nil && / #{ SEPARATOR_PAT } /o . match? ( @path )
531
+ chop_basename ( @path ) == nil && SEPARATOR_PAT . match? ( @path )
532
532
end
533
533
534
534
# Predicate method for testing whether a path is absolute.
@@ -698,7 +698,7 @@ def plus(path1, path2) # -> path # :nodoc:
698
698
basename_list2 . shift
699
699
end
700
700
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 ) ) )
702
702
while !basename_list2 . empty? && basename_list2 . first == '..'
703
703
index_list2 . shift
704
704
basename_list2 . shift
0 commit comments