@@ -668,7 +668,7 @@ def compsys(sdone, ldone) # :nodoc:
668
668
669
669
( sopts +lopts ) . each do |opt |
670
670
# "(-x -c -r)-l[left justify]"
671
- if /^ --\[ no-\] (.+)$/ =~ opt
671
+ if /\A --\[ no-\] (.+)$/ =~ opt
672
672
o = $1
673
673
yield ( "--#{ o } " , desc . join ( "" ) )
674
674
yield ( "--no-#{ o } " , desc . join ( "" ) )
@@ -1508,7 +1508,7 @@ def make_switch(opts, block = nil)
1508
1508
raise ArgumentError , "unsupported argument type: #{ o } " , ParseError . filter_backtrace ( caller ( 4 ) )
1509
1509
when *ArgumentStyle . keys
1510
1510
style = notwice ( ArgumentStyle [ o ] , style , 'style' )
1511
- when /^ --no-([^\[ \] =\s ]*)(.+)?/
1511
+ when /\A --no-([^\[ \] =\s ]*)(.+)?/
1512
1512
q , a = $1, $2
1513
1513
o = notwice ( a ? Object : TrueClass , klass , 'type' )
1514
1514
not_pattern , not_conv = search ( :atype , o ) unless not_style
@@ -1519,7 +1519,7 @@ def make_switch(opts, block = nil)
1519
1519
( q = q . downcase ) . tr! ( '_' , '-' )
1520
1520
long << "no-#{ q } "
1521
1521
nolong << q
1522
- when /^ --\[ no-\] ([^\[ \] =\s ]*)(.+)?/
1522
+ when /\A --\[ no-\] ([^\[ \] =\s ]*)(.+)?/
1523
1523
q , a = $1, $2
1524
1524
o = notwice ( a ? Object : TrueClass , klass , 'type' )
1525
1525
if a
@@ -1532,7 +1532,7 @@ def make_switch(opts, block = nil)
1532
1532
not_pattern , not_conv = search ( :atype , FalseClass ) unless not_style
1533
1533
not_style = Switch ::NoArgument
1534
1534
nolong << "no-#{ o } "
1535
- when /^ --([^\[ \] =\s ]*)(.+)?/
1535
+ when /\A --([^\[ \] =\s ]*)(.+)?/
1536
1536
q , a = $1, $2
1537
1537
if a
1538
1538
o = notwice ( NilClass , klass , 'type' )
@@ -1542,7 +1542,7 @@ def make_switch(opts, block = nil)
1542
1542
ldesc << "--#{ q } "
1543
1543
( o = q . downcase ) . tr! ( '_' , '-' )
1544
1544
long << o
1545
- when /^ -(\[ \^ ?\] ?(?:[^\\ \] ]|\\ .)*\] )(.+)?/
1545
+ when /\A -(\[ \^ ?\] ?(?:[^\\ \] ]|\\ .)*\] )(.+)?/
1546
1546
q , a = $1, $2
1547
1547
o = notwice ( Object , klass , 'type' )
1548
1548
if a
@@ -1553,7 +1553,7 @@ def make_switch(opts, block = nil)
1553
1553
end
1554
1554
sdesc << "-#{ q } "
1555
1555
short << Regexp . new ( q )
1556
- when /^ -(.)(.+)?/
1556
+ when /\A -(.)(.+)?/
1557
1557
q , a = $1, $2
1558
1558
if a
1559
1559
o = notwice ( NilClass , klass , 'type' )
@@ -1562,7 +1562,7 @@ def make_switch(opts, block = nil)
1562
1562
end
1563
1563
sdesc << "-#{ q } "
1564
1564
short << q
1565
- when /^ =/
1565
+ when /\A =/
1566
1566
style = notwice ( default_style . guess ( arg = o ) , style , 'style' )
1567
1567
default_pattern , conv = search ( :atype , Object ) unless default_pattern
1568
1568
else
0 commit comments